├── .cargo
└── config.toml
├── .dockerignore
├── .github
└── workflows
│ ├── ci.yml
│ └── release.yml
├── .gitignore
├── CHANGELOG.md
├── Cargo.lock
├── Cargo.toml
├── Dockerfile
├── LICENSE
├── README.md
├── pgx_ulid.control
└── src
├── bin
└── pgrx_embed.rs
└── lib.rs
/.cargo/config.toml:
--------------------------------------------------------------------------------
1 | [target.'cfg(target_os="macos")']
2 | # Postgres symbols won't be available until runtime
3 | rustflags = ["-Clink-arg=-Wl,-undefined,dynamic_lookup"]
4 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | .git
2 | .github
3 | .gitignore
4 | *.md
5 | *.yml
6 |
7 | target
8 | Cargo.lock
9 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 | on:
3 | pull_request:
4 | branches: [master]
5 | concurrency:
6 | group: ${{ github.workflow }}-${{ github.ref }}
7 | cancel-in-progress: true
8 | jobs:
9 | ci:
10 | name: CI
11 | needs: [test, lint, lockfile]
12 | runs-on: ubuntu-latest
13 | steps:
14 | - name: Done
15 | run: exit 0
16 | test:
17 | name: Tests
18 | strategy:
19 | fail-fast: false
20 | matrix:
21 | postgres: [14, 15, 16, 17]
22 | runner:
23 | - ubuntu-22.04
24 | - ubuntu-22.04-arm
25 | runs-on: ${{ matrix.runner }}
26 | steps:
27 | - name: Checkout
28 | uses: actions/checkout@v3
29 | - name: Build
30 | run: docker buildx build --build-arg PG_MAJOR=${{ matrix.postgres }} -t test .
31 | - name: Test
32 | run: docker run test cargo pgrx test pg${{ matrix.postgres }}
33 | lint:
34 | name: Linting (fmt + clippy)
35 | runs-on: ubuntu-latest
36 | steps:
37 | - name: Install rust
38 | uses: dtolnay/rust-toolchain@1.81.0
39 | with:
40 | components: rustfmt, clippy
41 | - name: Checkout
42 | uses: actions/checkout@v3
43 | - name: Format check
44 | uses: actions-rs/cargo@v1
45 | with:
46 | command: fmt
47 | args: -- --check
48 |
49 | lockfile:
50 | runs-on: ubuntu-latest
51 | steps:
52 | - name: Checkout
53 | uses: actions/checkout@v3
54 | - name: Install rust
55 | uses: dtolnay/rust-toolchain@1.81.0
56 | - name: Lockfile check
57 | run: cargo update -w --locked
58 |
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | env:
2 | NAME: pgx_ulid
3 | EXT_NAME: ulid
4 | PKG_NAME: pg-ulid
5 | name: Release
6 | on:
7 | push:
8 | tags: [v*]
9 | concurrency:
10 | group: ${{ github.workflow }}-${{ github.ref }}
11 | jobs:
12 | create-release:
13 | name: Create release
14 | runs-on: ubuntu-latest
15 | outputs:
16 | upload_url: ${{ steps.create-release.outputs.upload_url }}
17 | steps:
18 | - name: Create Release
19 | id: create-release
20 | uses: actions/create-release@v1
21 | env:
22 | GITHUB_TOKEN: ${{ github.token }}
23 | with:
24 | tag_name: ${{ github.ref }}
25 | release_name: ${{ github.ref }}
26 | build-linux-gnu:
27 | name: Build & Release for linux
28 | needs:
29 | - create-release
30 | strategy:
31 | fail-fast: false
32 | matrix:
33 | postgres: [14, 15, 16, 17]
34 | box:
35 | - runner: ubuntu-22.04
36 | arch: amd64
37 | - runner: ubuntu-22.04-arm
38 | arch: arm64
39 | runs-on: ${{ matrix.box.runner }}
40 | timeout-minutes: 45
41 | steps:
42 | - name: Checkout
43 | uses: actions/checkout@v3
44 | - name: Install rust
45 | uses: dtolnay/rust-toolchain@1.81.0
46 | - name: Install dependencies
47 | run: |
48 | # Add postgres package repo
49 | sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
50 | wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null
51 |
52 | sudo apt-get update
53 | sudo apt-get install -y --no-install-recommends git build-essential libpq-dev curl libreadline6-dev zlib1g-dev pkg-config cmake
54 | sudo apt-get install -y --no-install-recommends libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc ccache
55 | sudo apt-get install -y --no-install-recommends clang libclang-dev llvm-dev gcc tree
56 |
57 | # Install requested postgres version
58 | sudo apt-get install -y postgresql-${{ matrix.postgres }} postgresql-server-dev-${{ matrix.postgres }} -y
59 |
60 | # Ensure installed pg_config is first on path
61 | export PATH=$PATH:/usr/lib/postgresql/${{ matrix.postgres }}/bin
62 |
63 | cargo install cargo-pgrx --version 0.12.7 --locked
64 | cargo pgrx init --pg${{ matrix.postgres }}=/usr/lib/postgresql/${{ matrix.postgres }}/bin/pg_config
65 | - name: Build artifacts
66 | run: |
67 | # selects the pgVer from pg_config on path
68 | # https://github.com/tcdi/pgrx/issues/288
69 | cargo pgrx package --no-default-features --features pg${{ matrix.postgres }}
70 | - name: Package artifacts
71 | run: |
72 | # Extract extension version
73 | extension_version=${{ github.ref_name }}
74 | clean_version=${extension_version:1}
75 |
76 | # Extract the created files
77 | mkdir archive
78 | cp `find target/release -type f -name "${{ env.NAME }}*"` archive
79 |
80 | # Rename files
81 | mv archive/${{ env.NAME }}.control archive/${{ env.EXT_NAME }}.control
82 | mv archive/${{ env.NAME }}--${clean_version}.sql archive/${{ env.EXT_NAME }}--${clean_version}.sql
83 |
84 | # Copy files into directory structure
85 | mkdir -p package/usr/lib/postgresql/lib
86 | mkdir -p package/var/lib/postgresql/extension
87 |
88 | cp archive/*.so package/usr/lib/postgresql/lib
89 | cp archive/*.control package/var/lib/postgresql/extension
90 | cp archive/*.sql package/var/lib/postgresql/extension
91 |
92 | # symlinks to copy files into directory structure
93 | mkdir -p package/usr/lib/postgresql/${{ matrix.postgres }}/lib
94 | cd package/usr/lib/postgresql/${{ matrix.postgres }}/lib
95 | cp -s ../../lib/*.so .
96 | cd ../../../../../..
97 |
98 | mkdir -p package/usr/share/postgresql/${{ matrix.postgres }}/extension
99 | cd package/usr/share/postgresql/${{ matrix.postgres }}/extension
100 | cp -s ../../../../../var/lib/postgresql/extension/*.control .
101 | cp -s ../../../../../var/lib/postgresql/extension/*.sql .
102 | cd ../../../../../..
103 |
104 | # Create control file
105 | mkdir -p package/DEBIAN
106 | touch package/DEBIAN/control
107 | echo 'Package: ${{ env.PKG_NAME }}' >> package/DEBIAN/control
108 | echo 'Version:' ${clean_version} >> package/DEBIAN/control
109 | echo 'Architecture: ${{ matrix.box.arch }}' >> package/DEBIAN/control
110 | echo 'Maintainer: Pavan Sunkara' >> package/DEBIAN/control
111 | echo 'Description: A PostgreSQL extension for ULID' >> package/DEBIAN/control
112 |
113 | # Create deb package
114 | sudo chown -R root:root package
115 | sudo chmod -R 00755 package
116 | sudo dpkg-deb -Zxz --build --root-owner-group package
117 | - name: Upload artifacts
118 | uses: actions/upload-release-asset@v1
119 | env:
120 | GITHUB_TOKEN: ${{ github.token }}
121 | with:
122 | upload_url: ${{ needs.create-release.outputs.upload_url }}
123 | asset_path: ./package.deb
124 | asset_name: ${{ env.NAME }}-${{ github.ref_name }}-pg${{ matrix.postgres }}-${{ matrix.box.arch }}-linux-gnu.deb
125 | asset_content_type: application/vnd.debian.binary-package
126 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## 0.2.0
4 |
5 | #### BREAKING
6 | * Removed support for Postgres 11, 12 & 13
7 |
8 | #### Enhancements
9 | * Added support for Postgres 17
10 | * Better error code for error messages
11 |
12 | ## 0.1.5
13 |
14 | #### Enhancements
15 | * Added support for casting to bytea
16 |
17 | ## 0.1.4
18 |
19 | #### Enhancements
20 | * Added support for Postgres 16
21 |
22 | ## 0.1.3
23 |
24 | #### Enhancements
25 | * Added support for casting a timestamp to ulid
26 |
27 | ## 0.1.2
28 |
29 | ### Bug fixes
30 | * Fixed bugs regarding table joins for the type
31 |
32 | ## 0.1.1
33 |
34 | #### Enhancements
35 | * Added support for monotonic ulids
36 |
37 | ## 0.1.0
38 |
39 | Initial release
40 |
--------------------------------------------------------------------------------
/Cargo.lock:
--------------------------------------------------------------------------------
1 | # This file is automatically @generated by Cargo.
2 | # It is not intended for manual editing.
3 | version = 3
4 |
5 | [[package]]
6 | name = "addr2line"
7 | version = "0.24.1"
8 | source = "registry+https://github.com/rust-lang/crates.io-index"
9 | checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375"
10 | dependencies = [
11 | "gimli",
12 | ]
13 |
14 | [[package]]
15 | name = "adler2"
16 | version = "2.0.0"
17 | source = "registry+https://github.com/rust-lang/crates.io-index"
18 | checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
19 |
20 | [[package]]
21 | name = "aho-corasick"
22 | version = "1.1.3"
23 | source = "registry+https://github.com/rust-lang/crates.io-index"
24 | checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
25 | dependencies = [
26 | "memchr",
27 | ]
28 |
29 | [[package]]
30 | name = "annotate-snippets"
31 | version = "0.9.2"
32 | source = "registry+https://github.com/rust-lang/crates.io-index"
33 | checksum = "ccaf7e9dfbb6ab22c82e473cd1a8a7bd313c19a5b7e40970f3d89ef5a5c9e81e"
34 | dependencies = [
35 | "unicode-width",
36 | "yansi-term",
37 | ]
38 |
39 | [[package]]
40 | name = "anstyle"
41 | version = "1.0.8"
42 | source = "registry+https://github.com/rust-lang/crates.io-index"
43 | checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
44 |
45 | [[package]]
46 | name = "anyhow"
47 | version = "1.0.89"
48 | source = "registry+https://github.com/rust-lang/crates.io-index"
49 | checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6"
50 |
51 | [[package]]
52 | name = "async-trait"
53 | version = "0.1.83"
54 | source = "registry+https://github.com/rust-lang/crates.io-index"
55 | checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd"
56 | dependencies = [
57 | "proc-macro2",
58 | "quote",
59 | "syn",
60 | ]
61 |
62 | [[package]]
63 | name = "atomic-traits"
64 | version = "0.3.0"
65 | source = "registry+https://github.com/rust-lang/crates.io-index"
66 | checksum = "b29ec3788e96fb4fdb275ccb9d62811f2fa903d76c5eb4dd6fe7d09a7ed5871f"
67 | dependencies = [
68 | "cfg-if",
69 | "rustc_version",
70 | ]
71 |
72 | [[package]]
73 | name = "autocfg"
74 | version = "1.4.0"
75 | source = "registry+https://github.com/rust-lang/crates.io-index"
76 | checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
77 |
78 | [[package]]
79 | name = "backtrace"
80 | version = "0.3.74"
81 | source = "registry+https://github.com/rust-lang/crates.io-index"
82 | checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a"
83 | dependencies = [
84 | "addr2line",
85 | "cfg-if",
86 | "libc",
87 | "miniz_oxide",
88 | "object",
89 | "rustc-demangle",
90 | "windows-targets",
91 | ]
92 |
93 | [[package]]
94 | name = "base64"
95 | version = "0.22.1"
96 | source = "registry+https://github.com/rust-lang/crates.io-index"
97 | checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
98 |
99 | [[package]]
100 | name = "bindgen"
101 | version = "0.70.1"
102 | source = "registry+https://github.com/rust-lang/crates.io-index"
103 | checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f"
104 | dependencies = [
105 | "annotate-snippets",
106 | "bitflags",
107 | "cexpr",
108 | "clang-sys",
109 | "itertools",
110 | "proc-macro2",
111 | "quote",
112 | "regex",
113 | "rustc-hash",
114 | "shlex",
115 | "syn",
116 | ]
117 |
118 | [[package]]
119 | name = "bit-set"
120 | version = "0.5.3"
121 | source = "registry+https://github.com/rust-lang/crates.io-index"
122 | checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1"
123 | dependencies = [
124 | "bit-vec",
125 | ]
126 |
127 | [[package]]
128 | name = "bit-vec"
129 | version = "0.6.3"
130 | source = "registry+https://github.com/rust-lang/crates.io-index"
131 | checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
132 |
133 | [[package]]
134 | name = "bitflags"
135 | version = "2.6.0"
136 | source = "registry+https://github.com/rust-lang/crates.io-index"
137 | checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
138 |
139 | [[package]]
140 | name = "bitvec"
141 | version = "1.0.1"
142 | source = "registry+https://github.com/rust-lang/crates.io-index"
143 | checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
144 | dependencies = [
145 | "funty",
146 | "radium",
147 | "tap",
148 | "wyz",
149 | ]
150 |
151 | [[package]]
152 | name = "block-buffer"
153 | version = "0.10.4"
154 | source = "registry+https://github.com/rust-lang/crates.io-index"
155 | checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
156 | dependencies = [
157 | "generic-array",
158 | ]
159 |
160 | [[package]]
161 | name = "bumpalo"
162 | version = "3.16.0"
163 | source = "registry+https://github.com/rust-lang/crates.io-index"
164 | checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
165 |
166 | [[package]]
167 | name = "byteorder"
168 | version = "1.5.0"
169 | source = "registry+https://github.com/rust-lang/crates.io-index"
170 | checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
171 |
172 | [[package]]
173 | name = "bytes"
174 | version = "1.7.2"
175 | source = "registry+https://github.com/rust-lang/crates.io-index"
176 | checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3"
177 |
178 | [[package]]
179 | name = "camino"
180 | version = "1.1.9"
181 | source = "registry+https://github.com/rust-lang/crates.io-index"
182 | checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3"
183 | dependencies = [
184 | "serde",
185 | ]
186 |
187 | [[package]]
188 | name = "cargo-platform"
189 | version = "0.1.8"
190 | source = "registry+https://github.com/rust-lang/crates.io-index"
191 | checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc"
192 | dependencies = [
193 | "serde",
194 | ]
195 |
196 | [[package]]
197 | name = "cargo_metadata"
198 | version = "0.18.1"
199 | source = "registry+https://github.com/rust-lang/crates.io-index"
200 | checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037"
201 | dependencies = [
202 | "camino",
203 | "cargo-platform",
204 | "semver 1.0.23",
205 | "serde",
206 | "serde_json",
207 | "thiserror",
208 | ]
209 |
210 | [[package]]
211 | name = "cargo_toml"
212 | version = "0.19.2"
213 | source = "registry+https://github.com/rust-lang/crates.io-index"
214 | checksum = "a98356df42a2eb1bd8f1793ae4ee4de48e384dd974ce5eac8eee802edb7492be"
215 | dependencies = [
216 | "serde",
217 | "toml",
218 | ]
219 |
220 | [[package]]
221 | name = "cc"
222 | version = "1.1.22"
223 | source = "registry+https://github.com/rust-lang/crates.io-index"
224 | checksum = "9540e661f81799159abee814118cc139a2004b3a3aa3ea37724a1b66530b90e0"
225 | dependencies = [
226 | "shlex",
227 | ]
228 |
229 | [[package]]
230 | name = "cee-scape"
231 | version = "0.2.0"
232 | source = "registry+https://github.com/rust-lang/crates.io-index"
233 | checksum = "4d67dfb052149f779f77e9ce089cea126e00657e8f0d11dafc7901fde4291101"
234 | dependencies = [
235 | "cc",
236 | "libc",
237 | ]
238 |
239 | [[package]]
240 | name = "cexpr"
241 | version = "0.6.0"
242 | source = "registry+https://github.com/rust-lang/crates.io-index"
243 | checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
244 | dependencies = [
245 | "nom",
246 | ]
247 |
248 | [[package]]
249 | name = "cfg-if"
250 | version = "1.0.0"
251 | source = "registry+https://github.com/rust-lang/crates.io-index"
252 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
253 |
254 | [[package]]
255 | name = "clang-sys"
256 | version = "1.8.1"
257 | source = "registry+https://github.com/rust-lang/crates.io-index"
258 | checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
259 | dependencies = [
260 | "glob",
261 | "libc",
262 | "libloading",
263 | ]
264 |
265 | [[package]]
266 | name = "clap"
267 | version = "4.5.18"
268 | source = "registry+https://github.com/rust-lang/crates.io-index"
269 | checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3"
270 | dependencies = [
271 | "clap_builder",
272 | "clap_derive",
273 | ]
274 |
275 | [[package]]
276 | name = "clap-cargo"
277 | version = "0.14.1"
278 | source = "registry+https://github.com/rust-lang/crates.io-index"
279 | checksum = "23b2ea69cefa96b848b73ad516ad1d59a195cdf9263087d977f648a818c8b43e"
280 | dependencies = [
281 | "anstyle",
282 | "cargo_metadata",
283 | "clap",
284 | ]
285 |
286 | [[package]]
287 | name = "clap_builder"
288 | version = "4.5.18"
289 | source = "registry+https://github.com/rust-lang/crates.io-index"
290 | checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b"
291 | dependencies = [
292 | "anstyle",
293 | "clap_lex",
294 | ]
295 |
296 | [[package]]
297 | name = "clap_derive"
298 | version = "4.5.18"
299 | source = "registry+https://github.com/rust-lang/crates.io-index"
300 | checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab"
301 | dependencies = [
302 | "heck",
303 | "proc-macro2",
304 | "quote",
305 | "syn",
306 | ]
307 |
308 | [[package]]
309 | name = "clap_lex"
310 | version = "0.7.2"
311 | source = "registry+https://github.com/rust-lang/crates.io-index"
312 | checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
313 |
314 | [[package]]
315 | name = "convert_case"
316 | version = "0.6.0"
317 | source = "registry+https://github.com/rust-lang/crates.io-index"
318 | checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca"
319 | dependencies = [
320 | "unicode-segmentation",
321 | ]
322 |
323 | [[package]]
324 | name = "core-foundation-sys"
325 | version = "0.8.7"
326 | source = "registry+https://github.com/rust-lang/crates.io-index"
327 | checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
328 |
329 | [[package]]
330 | name = "cpufeatures"
331 | version = "0.2.14"
332 | source = "registry+https://github.com/rust-lang/crates.io-index"
333 | checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0"
334 | dependencies = [
335 | "libc",
336 | ]
337 |
338 | [[package]]
339 | name = "crossbeam-deque"
340 | version = "0.8.5"
341 | source = "registry+https://github.com/rust-lang/crates.io-index"
342 | checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d"
343 | dependencies = [
344 | "crossbeam-epoch",
345 | "crossbeam-utils",
346 | ]
347 |
348 | [[package]]
349 | name = "crossbeam-epoch"
350 | version = "0.9.18"
351 | source = "registry+https://github.com/rust-lang/crates.io-index"
352 | checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
353 | dependencies = [
354 | "crossbeam-utils",
355 | ]
356 |
357 | [[package]]
358 | name = "crossbeam-utils"
359 | version = "0.8.20"
360 | source = "registry+https://github.com/rust-lang/crates.io-index"
361 | checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
362 |
363 | [[package]]
364 | name = "crypto-common"
365 | version = "0.1.6"
366 | source = "registry+https://github.com/rust-lang/crates.io-index"
367 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
368 | dependencies = [
369 | "generic-array",
370 | "typenum",
371 | ]
372 |
373 | [[package]]
374 | name = "digest"
375 | version = "0.10.7"
376 | source = "registry+https://github.com/rust-lang/crates.io-index"
377 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
378 | dependencies = [
379 | "block-buffer",
380 | "crypto-common",
381 | "subtle",
382 | ]
383 |
384 | [[package]]
385 | name = "either"
386 | version = "1.13.0"
387 | source = "registry+https://github.com/rust-lang/crates.io-index"
388 | checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
389 |
390 | [[package]]
391 | name = "enum-map"
392 | version = "2.7.3"
393 | source = "registry+https://github.com/rust-lang/crates.io-index"
394 | checksum = "6866f3bfdf8207509a033af1a75a7b08abda06bbaaeae6669323fd5a097df2e9"
395 | dependencies = [
396 | "enum-map-derive",
397 | ]
398 |
399 | [[package]]
400 | name = "enum-map-derive"
401 | version = "0.17.0"
402 | source = "registry+https://github.com/rust-lang/crates.io-index"
403 | checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb"
404 | dependencies = [
405 | "proc-macro2",
406 | "quote",
407 | "syn",
408 | ]
409 |
410 | [[package]]
411 | name = "equivalent"
412 | version = "1.0.1"
413 | source = "registry+https://github.com/rust-lang/crates.io-index"
414 | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
415 |
416 | [[package]]
417 | name = "errno"
418 | version = "0.3.9"
419 | source = "registry+https://github.com/rust-lang/crates.io-index"
420 | checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
421 | dependencies = [
422 | "libc",
423 | "windows-sys 0.52.0",
424 | ]
425 |
426 | [[package]]
427 | name = "eyre"
428 | version = "0.6.12"
429 | source = "registry+https://github.com/rust-lang/crates.io-index"
430 | checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec"
431 | dependencies = [
432 | "indenter",
433 | "once_cell",
434 | ]
435 |
436 | [[package]]
437 | name = "fallible-iterator"
438 | version = "0.2.0"
439 | source = "registry+https://github.com/rust-lang/crates.io-index"
440 | checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
441 |
442 | [[package]]
443 | name = "fastrand"
444 | version = "2.1.1"
445 | source = "registry+https://github.com/rust-lang/crates.io-index"
446 | checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6"
447 |
448 | [[package]]
449 | name = "fixedbitset"
450 | version = "0.4.2"
451 | source = "registry+https://github.com/rust-lang/crates.io-index"
452 | checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
453 |
454 | [[package]]
455 | name = "fnv"
456 | version = "1.0.7"
457 | source = "registry+https://github.com/rust-lang/crates.io-index"
458 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
459 |
460 | [[package]]
461 | name = "form_urlencoded"
462 | version = "1.2.1"
463 | source = "registry+https://github.com/rust-lang/crates.io-index"
464 | checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
465 | dependencies = [
466 | "percent-encoding",
467 | ]
468 |
469 | [[package]]
470 | name = "funty"
471 | version = "2.0.0"
472 | source = "registry+https://github.com/rust-lang/crates.io-index"
473 | checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
474 |
475 | [[package]]
476 | name = "futures-channel"
477 | version = "0.3.30"
478 | source = "registry+https://github.com/rust-lang/crates.io-index"
479 | checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78"
480 | dependencies = [
481 | "futures-core",
482 | "futures-sink",
483 | ]
484 |
485 | [[package]]
486 | name = "futures-core"
487 | version = "0.3.30"
488 | source = "registry+https://github.com/rust-lang/crates.io-index"
489 | checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
490 |
491 | [[package]]
492 | name = "futures-macro"
493 | version = "0.3.30"
494 | source = "registry+https://github.com/rust-lang/crates.io-index"
495 | checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
496 | dependencies = [
497 | "proc-macro2",
498 | "quote",
499 | "syn",
500 | ]
501 |
502 | [[package]]
503 | name = "futures-sink"
504 | version = "0.3.30"
505 | source = "registry+https://github.com/rust-lang/crates.io-index"
506 | checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5"
507 |
508 | [[package]]
509 | name = "futures-task"
510 | version = "0.3.30"
511 | source = "registry+https://github.com/rust-lang/crates.io-index"
512 | checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004"
513 |
514 | [[package]]
515 | name = "futures-util"
516 | version = "0.3.30"
517 | source = "registry+https://github.com/rust-lang/crates.io-index"
518 | checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
519 | dependencies = [
520 | "futures-core",
521 | "futures-macro",
522 | "futures-sink",
523 | "futures-task",
524 | "pin-project-lite",
525 | "pin-utils",
526 | "slab",
527 | ]
528 |
529 | [[package]]
530 | name = "generic-array"
531 | version = "0.14.7"
532 | source = "registry+https://github.com/rust-lang/crates.io-index"
533 | checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
534 | dependencies = [
535 | "typenum",
536 | "version_check",
537 | ]
538 |
539 | [[package]]
540 | name = "getrandom"
541 | version = "0.2.15"
542 | source = "registry+https://github.com/rust-lang/crates.io-index"
543 | checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
544 | dependencies = [
545 | "cfg-if",
546 | "js-sys",
547 | "libc",
548 | "wasi",
549 | "wasm-bindgen",
550 | ]
551 |
552 | [[package]]
553 | name = "gimli"
554 | version = "0.31.0"
555 | source = "registry+https://github.com/rust-lang/crates.io-index"
556 | checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64"
557 |
558 | [[package]]
559 | name = "glob"
560 | version = "0.3.1"
561 | source = "registry+https://github.com/rust-lang/crates.io-index"
562 | checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
563 |
564 | [[package]]
565 | name = "half"
566 | version = "1.8.3"
567 | source = "registry+https://github.com/rust-lang/crates.io-index"
568 | checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403"
569 |
570 | [[package]]
571 | name = "hash32"
572 | version = "0.3.1"
573 | source = "registry+https://github.com/rust-lang/crates.io-index"
574 | checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606"
575 | dependencies = [
576 | "byteorder",
577 | ]
578 |
579 | [[package]]
580 | name = "hashbrown"
581 | version = "0.14.5"
582 | source = "registry+https://github.com/rust-lang/crates.io-index"
583 | checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
584 |
585 | [[package]]
586 | name = "heapless"
587 | version = "0.8.0"
588 | source = "registry+https://github.com/rust-lang/crates.io-index"
589 | checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
590 | dependencies = [
591 | "hash32",
592 | "stable_deref_trait",
593 | ]
594 |
595 | [[package]]
596 | name = "heck"
597 | version = "0.5.0"
598 | source = "registry+https://github.com/rust-lang/crates.io-index"
599 | checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
600 |
601 | [[package]]
602 | name = "hermit-abi"
603 | version = "0.3.9"
604 | source = "registry+https://github.com/rust-lang/crates.io-index"
605 | checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
606 |
607 | [[package]]
608 | name = "hermit-abi"
609 | version = "0.4.0"
610 | source = "registry+https://github.com/rust-lang/crates.io-index"
611 | checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc"
612 |
613 | [[package]]
614 | name = "hmac"
615 | version = "0.12.1"
616 | source = "registry+https://github.com/rust-lang/crates.io-index"
617 | checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
618 | dependencies = [
619 | "digest",
620 | ]
621 |
622 | [[package]]
623 | name = "home"
624 | version = "0.5.9"
625 | source = "registry+https://github.com/rust-lang/crates.io-index"
626 | checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5"
627 | dependencies = [
628 | "windows-sys 0.52.0",
629 | ]
630 |
631 | [[package]]
632 | name = "idna"
633 | version = "0.5.0"
634 | source = "registry+https://github.com/rust-lang/crates.io-index"
635 | checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
636 | dependencies = [
637 | "unicode-bidi",
638 | "unicode-normalization",
639 | ]
640 |
641 | [[package]]
642 | name = "indenter"
643 | version = "0.3.3"
644 | source = "registry+https://github.com/rust-lang/crates.io-index"
645 | checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
646 |
647 | [[package]]
648 | name = "indexmap"
649 | version = "2.5.0"
650 | source = "registry+https://github.com/rust-lang/crates.io-index"
651 | checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5"
652 | dependencies = [
653 | "equivalent",
654 | "hashbrown",
655 | ]
656 |
657 | [[package]]
658 | name = "is-terminal"
659 | version = "0.4.13"
660 | source = "registry+https://github.com/rust-lang/crates.io-index"
661 | checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b"
662 | dependencies = [
663 | "hermit-abi 0.4.0",
664 | "libc",
665 | "windows-sys 0.52.0",
666 | ]
667 |
668 | [[package]]
669 | name = "is_ci"
670 | version = "1.2.0"
671 | source = "registry+https://github.com/rust-lang/crates.io-index"
672 | checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45"
673 |
674 | [[package]]
675 | name = "itertools"
676 | version = "0.13.0"
677 | source = "registry+https://github.com/rust-lang/crates.io-index"
678 | checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
679 | dependencies = [
680 | "either",
681 | ]
682 |
683 | [[package]]
684 | name = "itoa"
685 | version = "1.0.11"
686 | source = "registry+https://github.com/rust-lang/crates.io-index"
687 | checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
688 |
689 | [[package]]
690 | name = "js-sys"
691 | version = "0.3.70"
692 | source = "registry+https://github.com/rust-lang/crates.io-index"
693 | checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a"
694 | dependencies = [
695 | "wasm-bindgen",
696 | ]
697 |
698 | [[package]]
699 | name = "lazy_static"
700 | version = "1.5.0"
701 | source = "registry+https://github.com/rust-lang/crates.io-index"
702 | checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
703 |
704 | [[package]]
705 | name = "libc"
706 | version = "0.2.159"
707 | source = "registry+https://github.com/rust-lang/crates.io-index"
708 | checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
709 |
710 | [[package]]
711 | name = "libloading"
712 | version = "0.8.5"
713 | source = "registry+https://github.com/rust-lang/crates.io-index"
714 | checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
715 | dependencies = [
716 | "cfg-if",
717 | "windows-targets",
718 | ]
719 |
720 | [[package]]
721 | name = "libm"
722 | version = "0.2.8"
723 | source = "registry+https://github.com/rust-lang/crates.io-index"
724 | checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
725 |
726 | [[package]]
727 | name = "linux-raw-sys"
728 | version = "0.4.14"
729 | source = "registry+https://github.com/rust-lang/crates.io-index"
730 | checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
731 |
732 | [[package]]
733 | name = "lock_api"
734 | version = "0.4.12"
735 | source = "registry+https://github.com/rust-lang/crates.io-index"
736 | checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
737 | dependencies = [
738 | "autocfg",
739 | "scopeguard",
740 | ]
741 |
742 | [[package]]
743 | name = "log"
744 | version = "0.4.22"
745 | source = "registry+https://github.com/rust-lang/crates.io-index"
746 | checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
747 |
748 | [[package]]
749 | name = "md-5"
750 | version = "0.10.6"
751 | source = "registry+https://github.com/rust-lang/crates.io-index"
752 | checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf"
753 | dependencies = [
754 | "cfg-if",
755 | "digest",
756 | ]
757 |
758 | [[package]]
759 | name = "memchr"
760 | version = "2.7.4"
761 | source = "registry+https://github.com/rust-lang/crates.io-index"
762 | checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
763 |
764 | [[package]]
765 | name = "minimal-lexical"
766 | version = "0.2.1"
767 | source = "registry+https://github.com/rust-lang/crates.io-index"
768 | checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
769 |
770 | [[package]]
771 | name = "miniz_oxide"
772 | version = "0.8.0"
773 | source = "registry+https://github.com/rust-lang/crates.io-index"
774 | checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1"
775 | dependencies = [
776 | "adler2",
777 | ]
778 |
779 | [[package]]
780 | name = "mio"
781 | version = "1.0.2"
782 | source = "registry+https://github.com/rust-lang/crates.io-index"
783 | checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec"
784 | dependencies = [
785 | "hermit-abi 0.3.9",
786 | "libc",
787 | "wasi",
788 | "windows-sys 0.52.0",
789 | ]
790 |
791 | [[package]]
792 | name = "nom"
793 | version = "7.1.3"
794 | source = "registry+https://github.com/rust-lang/crates.io-index"
795 | checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
796 | dependencies = [
797 | "memchr",
798 | "minimal-lexical",
799 | ]
800 |
801 | [[package]]
802 | name = "ntapi"
803 | version = "0.4.1"
804 | source = "registry+https://github.com/rust-lang/crates.io-index"
805 | checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4"
806 | dependencies = [
807 | "winapi",
808 | ]
809 |
810 | [[package]]
811 | name = "num-traits"
812 | version = "0.2.19"
813 | source = "registry+https://github.com/rust-lang/crates.io-index"
814 | checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
815 | dependencies = [
816 | "autocfg",
817 | "libm",
818 | ]
819 |
820 | [[package]]
821 | name = "object"
822 | version = "0.36.4"
823 | source = "registry+https://github.com/rust-lang/crates.io-index"
824 | checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a"
825 | dependencies = [
826 | "memchr",
827 | ]
828 |
829 | [[package]]
830 | name = "once_cell"
831 | version = "1.19.0"
832 | source = "registry+https://github.com/rust-lang/crates.io-index"
833 | checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
834 |
835 | [[package]]
836 | name = "owo-colors"
837 | version = "4.1.0"
838 | source = "registry+https://github.com/rust-lang/crates.io-index"
839 | checksum = "fb37767f6569cd834a413442455e0f066d0d522de8630436e2a1761d9726ba56"
840 | dependencies = [
841 | "supports-color 2.1.0",
842 | "supports-color 3.0.1",
843 | ]
844 |
845 | [[package]]
846 | name = "parking_lot"
847 | version = "0.12.3"
848 | source = "registry+https://github.com/rust-lang/crates.io-index"
849 | checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
850 | dependencies = [
851 | "lock_api",
852 | "parking_lot_core",
853 | ]
854 |
855 | [[package]]
856 | name = "parking_lot_core"
857 | version = "0.9.10"
858 | source = "registry+https://github.com/rust-lang/crates.io-index"
859 | checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
860 | dependencies = [
861 | "cfg-if",
862 | "libc",
863 | "redox_syscall",
864 | "smallvec",
865 | "windows-targets",
866 | ]
867 |
868 | [[package]]
869 | name = "paste"
870 | version = "1.0.15"
871 | source = "registry+https://github.com/rust-lang/crates.io-index"
872 | checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
873 |
874 | [[package]]
875 | name = "pathsearch"
876 | version = "0.2.0"
877 | source = "registry+https://github.com/rust-lang/crates.io-index"
878 | checksum = "da983bc5e582ab17179c190b4b66c7d76c5943a69c6d34df2a2b6bf8a2977b05"
879 | dependencies = [
880 | "anyhow",
881 | "libc",
882 | ]
883 |
884 | [[package]]
885 | name = "percent-encoding"
886 | version = "2.3.1"
887 | source = "registry+https://github.com/rust-lang/crates.io-index"
888 | checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
889 |
890 | [[package]]
891 | name = "pest"
892 | version = "2.7.13"
893 | source = "registry+https://github.com/rust-lang/crates.io-index"
894 | checksum = "fdbef9d1d47087a895abd220ed25eb4ad973a5e26f6a4367b038c25e28dfc2d9"
895 | dependencies = [
896 | "memchr",
897 | "thiserror",
898 | "ucd-trie",
899 | ]
900 |
901 | [[package]]
902 | name = "petgraph"
903 | version = "0.6.5"
904 | source = "registry+https://github.com/rust-lang/crates.io-index"
905 | checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db"
906 | dependencies = [
907 | "fixedbitset",
908 | "indexmap",
909 | ]
910 |
911 | [[package]]
912 | name = "pgrx"
913 | version = "0.12.7"
914 | source = "registry+https://github.com/rust-lang/crates.io-index"
915 | checksum = "eb67c795a2718ecd599be132582fbc6b714ed9e15a23291bf08b565bab2be28e"
916 | dependencies = [
917 | "atomic-traits",
918 | "bitflags",
919 | "bitvec",
920 | "enum-map",
921 | "heapless",
922 | "libc",
923 | "once_cell",
924 | "pgrx-macros",
925 | "pgrx-pg-sys",
926 | "pgrx-sql-entity-graph",
927 | "seahash",
928 | "serde",
929 | "serde_cbor",
930 | "serde_json",
931 | "thiserror",
932 | "uuid",
933 | ]
934 |
935 | [[package]]
936 | name = "pgrx-bindgen"
937 | version = "0.12.7"
938 | source = "registry+https://github.com/rust-lang/crates.io-index"
939 | checksum = "433d56944dc948c6033cb38198895ff4a36432e2343c3b9891a0ec94d2913ef1"
940 | dependencies = [
941 | "bindgen",
942 | "cc",
943 | "clang-sys",
944 | "eyre",
945 | "pgrx-pg-config",
946 | "proc-macro2",
947 | "quote",
948 | "shlex",
949 | "syn",
950 | "walkdir",
951 | ]
952 |
953 | [[package]]
954 | name = "pgrx-macros"
955 | version = "0.12.7"
956 | source = "registry+https://github.com/rust-lang/crates.io-index"
957 | checksum = "9160f3affc241fa473a5f9e3bceca7cc8923132cbf81629f9851a01b81c674bf"
958 | dependencies = [
959 | "pgrx-sql-entity-graph",
960 | "proc-macro2",
961 | "quote",
962 | "syn",
963 | ]
964 |
965 | [[package]]
966 | name = "pgrx-pg-config"
967 | version = "0.12.7"
968 | source = "registry+https://github.com/rust-lang/crates.io-index"
969 | checksum = "5a0703033b0d1269ca9facdb436b439e3a92e303a6ea5c13107dd8b228c4c294"
970 | dependencies = [
971 | "cargo_toml",
972 | "eyre",
973 | "home",
974 | "owo-colors",
975 | "pathsearch",
976 | "serde",
977 | "serde_json",
978 | "thiserror",
979 | "toml",
980 | "url",
981 | ]
982 |
983 | [[package]]
984 | name = "pgrx-pg-sys"
985 | version = "0.12.7"
986 | source = "registry+https://github.com/rust-lang/crates.io-index"
987 | checksum = "b65132c32c8f90f4f6fa66d6b085cbd1657c95ea70e927104737f578ea9b7190"
988 | dependencies = [
989 | "cee-scape",
990 | "libc",
991 | "pgrx-bindgen",
992 | "pgrx-macros",
993 | "pgrx-sql-entity-graph",
994 | "serde",
995 | "sptr",
996 | ]
997 |
998 | [[package]]
999 | name = "pgrx-sql-entity-graph"
1000 | version = "0.12.7"
1001 | source = "registry+https://github.com/rust-lang/crates.io-index"
1002 | checksum = "0d1e11e53d544d2e84860493d0f983c9c58b927d1f24ddcd907602f89e3cb887"
1003 | dependencies = [
1004 | "convert_case",
1005 | "eyre",
1006 | "petgraph",
1007 | "proc-macro2",
1008 | "quote",
1009 | "syn",
1010 | "thiserror",
1011 | "unescape",
1012 | ]
1013 |
1014 | [[package]]
1015 | name = "pgrx-tests"
1016 | version = "0.12.7"
1017 | source = "registry+https://github.com/rust-lang/crates.io-index"
1018 | checksum = "f9f9b6c225f94c621f252e62fe0ac141ba452d177b79f32bab401aaf4f1db0b3"
1019 | dependencies = [
1020 | "clap-cargo",
1021 | "eyre",
1022 | "libc",
1023 | "owo-colors",
1024 | "paste",
1025 | "pgrx",
1026 | "pgrx-macros",
1027 | "pgrx-pg-config",
1028 | "postgres",
1029 | "proptest",
1030 | "rand",
1031 | "regex",
1032 | "serde",
1033 | "serde_json",
1034 | "sysinfo",
1035 | "thiserror",
1036 | ]
1037 |
1038 | [[package]]
1039 | name = "pgx_ulid"
1040 | version = "0.2.0"
1041 | dependencies = [
1042 | "pgrx",
1043 | "pgrx-tests",
1044 | "ulid",
1045 | ]
1046 |
1047 | [[package]]
1048 | name = "phf"
1049 | version = "0.11.2"
1050 | source = "registry+https://github.com/rust-lang/crates.io-index"
1051 | checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
1052 | dependencies = [
1053 | "phf_shared",
1054 | ]
1055 |
1056 | [[package]]
1057 | name = "phf_shared"
1058 | version = "0.11.2"
1059 | source = "registry+https://github.com/rust-lang/crates.io-index"
1060 | checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b"
1061 | dependencies = [
1062 | "siphasher",
1063 | ]
1064 |
1065 | [[package]]
1066 | name = "pin-project-lite"
1067 | version = "0.2.14"
1068 | source = "registry+https://github.com/rust-lang/crates.io-index"
1069 | checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
1070 |
1071 | [[package]]
1072 | name = "pin-utils"
1073 | version = "0.1.0"
1074 | source = "registry+https://github.com/rust-lang/crates.io-index"
1075 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
1076 |
1077 | [[package]]
1078 | name = "postgres"
1079 | version = "0.19.9"
1080 | source = "registry+https://github.com/rust-lang/crates.io-index"
1081 | checksum = "95c918733159f4d55d2ceb262950f00b0aebd6af4aa97b5a47bb0655120475ed"
1082 | dependencies = [
1083 | "bytes",
1084 | "fallible-iterator",
1085 | "futures-util",
1086 | "log",
1087 | "tokio",
1088 | "tokio-postgres",
1089 | ]
1090 |
1091 | [[package]]
1092 | name = "postgres-protocol"
1093 | version = "0.6.7"
1094 | source = "registry+https://github.com/rust-lang/crates.io-index"
1095 | checksum = "acda0ebdebc28befa84bee35e651e4c5f09073d668c7aed4cf7e23c3cda84b23"
1096 | dependencies = [
1097 | "base64",
1098 | "byteorder",
1099 | "bytes",
1100 | "fallible-iterator",
1101 | "hmac",
1102 | "md-5",
1103 | "memchr",
1104 | "rand",
1105 | "sha2",
1106 | "stringprep",
1107 | ]
1108 |
1109 | [[package]]
1110 | name = "postgres-types"
1111 | version = "0.2.8"
1112 | source = "registry+https://github.com/rust-lang/crates.io-index"
1113 | checksum = "f66ea23a2d0e5734297357705193335e0a957696f34bed2f2faefacb2fec336f"
1114 | dependencies = [
1115 | "bytes",
1116 | "fallible-iterator",
1117 | "postgres-protocol",
1118 | ]
1119 |
1120 | [[package]]
1121 | name = "ppv-lite86"
1122 | version = "0.2.20"
1123 | source = "registry+https://github.com/rust-lang/crates.io-index"
1124 | checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
1125 | dependencies = [
1126 | "zerocopy",
1127 | ]
1128 |
1129 | [[package]]
1130 | name = "proc-macro2"
1131 | version = "1.0.86"
1132 | source = "registry+https://github.com/rust-lang/crates.io-index"
1133 | checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
1134 | dependencies = [
1135 | "unicode-ident",
1136 | ]
1137 |
1138 | [[package]]
1139 | name = "proptest"
1140 | version = "1.5.0"
1141 | source = "registry+https://github.com/rust-lang/crates.io-index"
1142 | checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d"
1143 | dependencies = [
1144 | "bit-set",
1145 | "bit-vec",
1146 | "bitflags",
1147 | "lazy_static",
1148 | "num-traits",
1149 | "rand",
1150 | "rand_chacha",
1151 | "rand_xorshift",
1152 | "regex-syntax",
1153 | "rusty-fork",
1154 | "tempfile",
1155 | "unarray",
1156 | ]
1157 |
1158 | [[package]]
1159 | name = "quick-error"
1160 | version = "1.2.3"
1161 | source = "registry+https://github.com/rust-lang/crates.io-index"
1162 | checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
1163 |
1164 | [[package]]
1165 | name = "quote"
1166 | version = "1.0.37"
1167 | source = "registry+https://github.com/rust-lang/crates.io-index"
1168 | checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
1169 | dependencies = [
1170 | "proc-macro2",
1171 | ]
1172 |
1173 | [[package]]
1174 | name = "radium"
1175 | version = "0.7.0"
1176 | source = "registry+https://github.com/rust-lang/crates.io-index"
1177 | checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
1178 |
1179 | [[package]]
1180 | name = "rand"
1181 | version = "0.8.5"
1182 | source = "registry+https://github.com/rust-lang/crates.io-index"
1183 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
1184 | dependencies = [
1185 | "libc",
1186 | "rand_chacha",
1187 | "rand_core",
1188 | ]
1189 |
1190 | [[package]]
1191 | name = "rand_chacha"
1192 | version = "0.3.1"
1193 | source = "registry+https://github.com/rust-lang/crates.io-index"
1194 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
1195 | dependencies = [
1196 | "ppv-lite86",
1197 | "rand_core",
1198 | ]
1199 |
1200 | [[package]]
1201 | name = "rand_core"
1202 | version = "0.6.4"
1203 | source = "registry+https://github.com/rust-lang/crates.io-index"
1204 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
1205 | dependencies = [
1206 | "getrandom",
1207 | ]
1208 |
1209 | [[package]]
1210 | name = "rand_xorshift"
1211 | version = "0.3.0"
1212 | source = "registry+https://github.com/rust-lang/crates.io-index"
1213 | checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f"
1214 | dependencies = [
1215 | "rand_core",
1216 | ]
1217 |
1218 | [[package]]
1219 | name = "rayon"
1220 | version = "1.10.0"
1221 | source = "registry+https://github.com/rust-lang/crates.io-index"
1222 | checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
1223 | dependencies = [
1224 | "either",
1225 | "rayon-core",
1226 | ]
1227 |
1228 | [[package]]
1229 | name = "rayon-core"
1230 | version = "1.12.1"
1231 | source = "registry+https://github.com/rust-lang/crates.io-index"
1232 | checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
1233 | dependencies = [
1234 | "crossbeam-deque",
1235 | "crossbeam-utils",
1236 | ]
1237 |
1238 | [[package]]
1239 | name = "redox_syscall"
1240 | version = "0.5.6"
1241 | source = "registry+https://github.com/rust-lang/crates.io-index"
1242 | checksum = "355ae415ccd3a04315d3f8246e86d67689ea74d88d915576e1589a351062a13b"
1243 | dependencies = [
1244 | "bitflags",
1245 | ]
1246 |
1247 | [[package]]
1248 | name = "regex"
1249 | version = "1.10.6"
1250 | source = "registry+https://github.com/rust-lang/crates.io-index"
1251 | checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619"
1252 | dependencies = [
1253 | "aho-corasick",
1254 | "memchr",
1255 | "regex-automata",
1256 | "regex-syntax",
1257 | ]
1258 |
1259 | [[package]]
1260 | name = "regex-automata"
1261 | version = "0.4.7"
1262 | source = "registry+https://github.com/rust-lang/crates.io-index"
1263 | checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
1264 | dependencies = [
1265 | "aho-corasick",
1266 | "memchr",
1267 | "regex-syntax",
1268 | ]
1269 |
1270 | [[package]]
1271 | name = "regex-syntax"
1272 | version = "0.8.4"
1273 | source = "registry+https://github.com/rust-lang/crates.io-index"
1274 | checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
1275 |
1276 | [[package]]
1277 | name = "rustc-demangle"
1278 | version = "0.1.24"
1279 | source = "registry+https://github.com/rust-lang/crates.io-index"
1280 | checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
1281 |
1282 | [[package]]
1283 | name = "rustc-hash"
1284 | version = "1.1.0"
1285 | source = "registry+https://github.com/rust-lang/crates.io-index"
1286 | checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
1287 |
1288 | [[package]]
1289 | name = "rustc_version"
1290 | version = "0.3.3"
1291 | source = "registry+https://github.com/rust-lang/crates.io-index"
1292 | checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee"
1293 | dependencies = [
1294 | "semver 0.11.0",
1295 | ]
1296 |
1297 | [[package]]
1298 | name = "rustix"
1299 | version = "0.38.37"
1300 | source = "registry+https://github.com/rust-lang/crates.io-index"
1301 | checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811"
1302 | dependencies = [
1303 | "bitflags",
1304 | "errno",
1305 | "libc",
1306 | "linux-raw-sys",
1307 | "windows-sys 0.52.0",
1308 | ]
1309 |
1310 | [[package]]
1311 | name = "rusty-fork"
1312 | version = "0.3.0"
1313 | source = "registry+https://github.com/rust-lang/crates.io-index"
1314 | checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f"
1315 | dependencies = [
1316 | "fnv",
1317 | "quick-error",
1318 | "tempfile",
1319 | "wait-timeout",
1320 | ]
1321 |
1322 | [[package]]
1323 | name = "ryu"
1324 | version = "1.0.18"
1325 | source = "registry+https://github.com/rust-lang/crates.io-index"
1326 | checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
1327 |
1328 | [[package]]
1329 | name = "same-file"
1330 | version = "1.0.6"
1331 | source = "registry+https://github.com/rust-lang/crates.io-index"
1332 | checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
1333 | dependencies = [
1334 | "winapi-util",
1335 | ]
1336 |
1337 | [[package]]
1338 | name = "scopeguard"
1339 | version = "1.2.0"
1340 | source = "registry+https://github.com/rust-lang/crates.io-index"
1341 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
1342 |
1343 | [[package]]
1344 | name = "seahash"
1345 | version = "4.1.0"
1346 | source = "registry+https://github.com/rust-lang/crates.io-index"
1347 | checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
1348 |
1349 | [[package]]
1350 | name = "semver"
1351 | version = "0.11.0"
1352 | source = "registry+https://github.com/rust-lang/crates.io-index"
1353 | checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
1354 | dependencies = [
1355 | "semver-parser",
1356 | ]
1357 |
1358 | [[package]]
1359 | name = "semver"
1360 | version = "1.0.23"
1361 | source = "registry+https://github.com/rust-lang/crates.io-index"
1362 | checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
1363 | dependencies = [
1364 | "serde",
1365 | ]
1366 |
1367 | [[package]]
1368 | name = "semver-parser"
1369 | version = "0.10.2"
1370 | source = "registry+https://github.com/rust-lang/crates.io-index"
1371 | checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7"
1372 | dependencies = [
1373 | "pest",
1374 | ]
1375 |
1376 | [[package]]
1377 | name = "serde"
1378 | version = "1.0.210"
1379 | source = "registry+https://github.com/rust-lang/crates.io-index"
1380 | checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
1381 | dependencies = [
1382 | "serde_derive",
1383 | ]
1384 |
1385 | [[package]]
1386 | name = "serde_cbor"
1387 | version = "0.11.2"
1388 | source = "registry+https://github.com/rust-lang/crates.io-index"
1389 | checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5"
1390 | dependencies = [
1391 | "half",
1392 | "serde",
1393 | ]
1394 |
1395 | [[package]]
1396 | name = "serde_derive"
1397 | version = "1.0.210"
1398 | source = "registry+https://github.com/rust-lang/crates.io-index"
1399 | checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
1400 | dependencies = [
1401 | "proc-macro2",
1402 | "quote",
1403 | "syn",
1404 | ]
1405 |
1406 | [[package]]
1407 | name = "serde_json"
1408 | version = "1.0.128"
1409 | source = "registry+https://github.com/rust-lang/crates.io-index"
1410 | checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
1411 | dependencies = [
1412 | "itoa",
1413 | "memchr",
1414 | "ryu",
1415 | "serde",
1416 | ]
1417 |
1418 | [[package]]
1419 | name = "serde_spanned"
1420 | version = "0.6.8"
1421 | source = "registry+https://github.com/rust-lang/crates.io-index"
1422 | checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
1423 | dependencies = [
1424 | "serde",
1425 | ]
1426 |
1427 | [[package]]
1428 | name = "sha2"
1429 | version = "0.10.8"
1430 | source = "registry+https://github.com/rust-lang/crates.io-index"
1431 | checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
1432 | dependencies = [
1433 | "cfg-if",
1434 | "cpufeatures",
1435 | "digest",
1436 | ]
1437 |
1438 | [[package]]
1439 | name = "shlex"
1440 | version = "1.3.0"
1441 | source = "registry+https://github.com/rust-lang/crates.io-index"
1442 | checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
1443 |
1444 | [[package]]
1445 | name = "siphasher"
1446 | version = "0.3.11"
1447 | source = "registry+https://github.com/rust-lang/crates.io-index"
1448 | checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
1449 |
1450 | [[package]]
1451 | name = "slab"
1452 | version = "0.4.9"
1453 | source = "registry+https://github.com/rust-lang/crates.io-index"
1454 | checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
1455 | dependencies = [
1456 | "autocfg",
1457 | ]
1458 |
1459 | [[package]]
1460 | name = "smallvec"
1461 | version = "1.13.2"
1462 | source = "registry+https://github.com/rust-lang/crates.io-index"
1463 | checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
1464 |
1465 | [[package]]
1466 | name = "socket2"
1467 | version = "0.5.7"
1468 | source = "registry+https://github.com/rust-lang/crates.io-index"
1469 | checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
1470 | dependencies = [
1471 | "libc",
1472 | "windows-sys 0.52.0",
1473 | ]
1474 |
1475 | [[package]]
1476 | name = "sptr"
1477 | version = "0.3.2"
1478 | source = "registry+https://github.com/rust-lang/crates.io-index"
1479 | checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a"
1480 |
1481 | [[package]]
1482 | name = "stable_deref_trait"
1483 | version = "1.2.0"
1484 | source = "registry+https://github.com/rust-lang/crates.io-index"
1485 | checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
1486 |
1487 | [[package]]
1488 | name = "stringprep"
1489 | version = "0.1.5"
1490 | source = "registry+https://github.com/rust-lang/crates.io-index"
1491 | checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1"
1492 | dependencies = [
1493 | "unicode-bidi",
1494 | "unicode-normalization",
1495 | "unicode-properties",
1496 | ]
1497 |
1498 | [[package]]
1499 | name = "subtle"
1500 | version = "2.6.1"
1501 | source = "registry+https://github.com/rust-lang/crates.io-index"
1502 | checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
1503 |
1504 | [[package]]
1505 | name = "supports-color"
1506 | version = "2.1.0"
1507 | source = "registry+https://github.com/rust-lang/crates.io-index"
1508 | checksum = "d6398cde53adc3c4557306a96ce67b302968513830a77a95b2b17305d9719a89"
1509 | dependencies = [
1510 | "is-terminal",
1511 | "is_ci",
1512 | ]
1513 |
1514 | [[package]]
1515 | name = "supports-color"
1516 | version = "3.0.1"
1517 | source = "registry+https://github.com/rust-lang/crates.io-index"
1518 | checksum = "8775305acf21c96926c900ad056abeef436701108518cf890020387236ac5a77"
1519 | dependencies = [
1520 | "is_ci",
1521 | ]
1522 |
1523 | [[package]]
1524 | name = "syn"
1525 | version = "2.0.77"
1526 | source = "registry+https://github.com/rust-lang/crates.io-index"
1527 | checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed"
1528 | dependencies = [
1529 | "proc-macro2",
1530 | "quote",
1531 | "unicode-ident",
1532 | ]
1533 |
1534 | [[package]]
1535 | name = "sysinfo"
1536 | version = "0.30.13"
1537 | source = "registry+https://github.com/rust-lang/crates.io-index"
1538 | checksum = "0a5b4ddaee55fb2bea2bf0e5000747e5f5c0de765e5a5ff87f4cd106439f4bb3"
1539 | dependencies = [
1540 | "cfg-if",
1541 | "core-foundation-sys",
1542 | "libc",
1543 | "ntapi",
1544 | "once_cell",
1545 | "rayon",
1546 | "windows",
1547 | ]
1548 |
1549 | [[package]]
1550 | name = "tap"
1551 | version = "1.0.1"
1552 | source = "registry+https://github.com/rust-lang/crates.io-index"
1553 | checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
1554 |
1555 | [[package]]
1556 | name = "tempfile"
1557 | version = "3.12.0"
1558 | source = "registry+https://github.com/rust-lang/crates.io-index"
1559 | checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64"
1560 | dependencies = [
1561 | "cfg-if",
1562 | "fastrand",
1563 | "once_cell",
1564 | "rustix",
1565 | "windows-sys 0.59.0",
1566 | ]
1567 |
1568 | [[package]]
1569 | name = "thiserror"
1570 | version = "1.0.64"
1571 | source = "registry+https://github.com/rust-lang/crates.io-index"
1572 | checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
1573 | dependencies = [
1574 | "thiserror-impl",
1575 | ]
1576 |
1577 | [[package]]
1578 | name = "thiserror-impl"
1579 | version = "1.0.64"
1580 | source = "registry+https://github.com/rust-lang/crates.io-index"
1581 | checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
1582 | dependencies = [
1583 | "proc-macro2",
1584 | "quote",
1585 | "syn",
1586 | ]
1587 |
1588 | [[package]]
1589 | name = "tinyvec"
1590 | version = "1.8.0"
1591 | source = "registry+https://github.com/rust-lang/crates.io-index"
1592 | checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938"
1593 | dependencies = [
1594 | "tinyvec_macros",
1595 | ]
1596 |
1597 | [[package]]
1598 | name = "tinyvec_macros"
1599 | version = "0.1.1"
1600 | source = "registry+https://github.com/rust-lang/crates.io-index"
1601 | checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
1602 |
1603 | [[package]]
1604 | name = "tokio"
1605 | version = "1.40.0"
1606 | source = "registry+https://github.com/rust-lang/crates.io-index"
1607 | checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998"
1608 | dependencies = [
1609 | "backtrace",
1610 | "bytes",
1611 | "libc",
1612 | "mio",
1613 | "pin-project-lite",
1614 | "socket2",
1615 | "windows-sys 0.52.0",
1616 | ]
1617 |
1618 | [[package]]
1619 | name = "tokio-postgres"
1620 | version = "0.7.12"
1621 | source = "registry+https://github.com/rust-lang/crates.io-index"
1622 | checksum = "3b5d3742945bc7d7f210693b0c58ae542c6fd47b17adbbda0885f3dcb34a6bdb"
1623 | dependencies = [
1624 | "async-trait",
1625 | "byteorder",
1626 | "bytes",
1627 | "fallible-iterator",
1628 | "futures-channel",
1629 | "futures-util",
1630 | "log",
1631 | "parking_lot",
1632 | "percent-encoding",
1633 | "phf",
1634 | "pin-project-lite",
1635 | "postgres-protocol",
1636 | "postgres-types",
1637 | "rand",
1638 | "socket2",
1639 | "tokio",
1640 | "tokio-util",
1641 | "whoami",
1642 | ]
1643 |
1644 | [[package]]
1645 | name = "tokio-util"
1646 | version = "0.7.12"
1647 | source = "registry+https://github.com/rust-lang/crates.io-index"
1648 | checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a"
1649 | dependencies = [
1650 | "bytes",
1651 | "futures-core",
1652 | "futures-sink",
1653 | "pin-project-lite",
1654 | "tokio",
1655 | ]
1656 |
1657 | [[package]]
1658 | name = "toml"
1659 | version = "0.8.19"
1660 | source = "registry+https://github.com/rust-lang/crates.io-index"
1661 | checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
1662 | dependencies = [
1663 | "serde",
1664 | "serde_spanned",
1665 | "toml_datetime",
1666 | "toml_edit",
1667 | ]
1668 |
1669 | [[package]]
1670 | name = "toml_datetime"
1671 | version = "0.6.8"
1672 | source = "registry+https://github.com/rust-lang/crates.io-index"
1673 | checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
1674 | dependencies = [
1675 | "serde",
1676 | ]
1677 |
1678 | [[package]]
1679 | name = "toml_edit"
1680 | version = "0.22.22"
1681 | source = "registry+https://github.com/rust-lang/crates.io-index"
1682 | checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
1683 | dependencies = [
1684 | "indexmap",
1685 | "serde",
1686 | "serde_spanned",
1687 | "toml_datetime",
1688 | "winnow",
1689 | ]
1690 |
1691 | [[package]]
1692 | name = "typenum"
1693 | version = "1.17.0"
1694 | source = "registry+https://github.com/rust-lang/crates.io-index"
1695 | checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
1696 |
1697 | [[package]]
1698 | name = "ucd-trie"
1699 | version = "0.1.6"
1700 | source = "registry+https://github.com/rust-lang/crates.io-index"
1701 | checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"
1702 |
1703 | [[package]]
1704 | name = "ulid"
1705 | version = "1.1.3"
1706 | source = "registry+https://github.com/rust-lang/crates.io-index"
1707 | checksum = "04f903f293d11f31c0c29e4148f6dc0d033a7f80cebc0282bea147611667d289"
1708 | dependencies = [
1709 | "getrandom",
1710 | "rand",
1711 | "web-time",
1712 | ]
1713 |
1714 | [[package]]
1715 | name = "unarray"
1716 | version = "0.1.4"
1717 | source = "registry+https://github.com/rust-lang/crates.io-index"
1718 | checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94"
1719 |
1720 | [[package]]
1721 | name = "unescape"
1722 | version = "0.1.0"
1723 | source = "registry+https://github.com/rust-lang/crates.io-index"
1724 | checksum = "ccb97dac3243214f8d8507998906ca3e2e0b900bf9bf4870477f125b82e68f6e"
1725 |
1726 | [[package]]
1727 | name = "unicode-bidi"
1728 | version = "0.3.15"
1729 | source = "registry+https://github.com/rust-lang/crates.io-index"
1730 | checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75"
1731 |
1732 | [[package]]
1733 | name = "unicode-ident"
1734 | version = "1.0.13"
1735 | source = "registry+https://github.com/rust-lang/crates.io-index"
1736 | checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
1737 |
1738 | [[package]]
1739 | name = "unicode-normalization"
1740 | version = "0.1.24"
1741 | source = "registry+https://github.com/rust-lang/crates.io-index"
1742 | checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956"
1743 | dependencies = [
1744 | "tinyvec",
1745 | ]
1746 |
1747 | [[package]]
1748 | name = "unicode-properties"
1749 | version = "0.1.2"
1750 | source = "registry+https://github.com/rust-lang/crates.io-index"
1751 | checksum = "52ea75f83c0137a9b98608359a5f1af8144876eb67bcb1ce837368e906a9f524"
1752 |
1753 | [[package]]
1754 | name = "unicode-segmentation"
1755 | version = "1.12.0"
1756 | source = "registry+https://github.com/rust-lang/crates.io-index"
1757 | checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
1758 |
1759 | [[package]]
1760 | name = "unicode-width"
1761 | version = "0.1.14"
1762 | source = "registry+https://github.com/rust-lang/crates.io-index"
1763 | checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
1764 |
1765 | [[package]]
1766 | name = "url"
1767 | version = "2.5.2"
1768 | source = "registry+https://github.com/rust-lang/crates.io-index"
1769 | checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
1770 | dependencies = [
1771 | "form_urlencoded",
1772 | "idna",
1773 | "percent-encoding",
1774 | ]
1775 |
1776 | [[package]]
1777 | name = "uuid"
1778 | version = "1.10.0"
1779 | source = "registry+https://github.com/rust-lang/crates.io-index"
1780 | checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314"
1781 | dependencies = [
1782 | "getrandom",
1783 | ]
1784 |
1785 | [[package]]
1786 | name = "version_check"
1787 | version = "0.9.5"
1788 | source = "registry+https://github.com/rust-lang/crates.io-index"
1789 | checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
1790 |
1791 | [[package]]
1792 | name = "wait-timeout"
1793 | version = "0.2.0"
1794 | source = "registry+https://github.com/rust-lang/crates.io-index"
1795 | checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
1796 | dependencies = [
1797 | "libc",
1798 | ]
1799 |
1800 | [[package]]
1801 | name = "walkdir"
1802 | version = "2.5.0"
1803 | source = "registry+https://github.com/rust-lang/crates.io-index"
1804 | checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
1805 | dependencies = [
1806 | "same-file",
1807 | "winapi-util",
1808 | ]
1809 |
1810 | [[package]]
1811 | name = "wasi"
1812 | version = "0.11.0+wasi-snapshot-preview1"
1813 | source = "registry+https://github.com/rust-lang/crates.io-index"
1814 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
1815 |
1816 | [[package]]
1817 | name = "wasite"
1818 | version = "0.1.0"
1819 | source = "registry+https://github.com/rust-lang/crates.io-index"
1820 | checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
1821 |
1822 | [[package]]
1823 | name = "wasm-bindgen"
1824 | version = "0.2.93"
1825 | source = "registry+https://github.com/rust-lang/crates.io-index"
1826 | checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5"
1827 | dependencies = [
1828 | "cfg-if",
1829 | "once_cell",
1830 | "wasm-bindgen-macro",
1831 | ]
1832 |
1833 | [[package]]
1834 | name = "wasm-bindgen-backend"
1835 | version = "0.2.93"
1836 | source = "registry+https://github.com/rust-lang/crates.io-index"
1837 | checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b"
1838 | dependencies = [
1839 | "bumpalo",
1840 | "log",
1841 | "once_cell",
1842 | "proc-macro2",
1843 | "quote",
1844 | "syn",
1845 | "wasm-bindgen-shared",
1846 | ]
1847 |
1848 | [[package]]
1849 | name = "wasm-bindgen-macro"
1850 | version = "0.2.93"
1851 | source = "registry+https://github.com/rust-lang/crates.io-index"
1852 | checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf"
1853 | dependencies = [
1854 | "quote",
1855 | "wasm-bindgen-macro-support",
1856 | ]
1857 |
1858 | [[package]]
1859 | name = "wasm-bindgen-macro-support"
1860 | version = "0.2.93"
1861 | source = "registry+https://github.com/rust-lang/crates.io-index"
1862 | checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
1863 | dependencies = [
1864 | "proc-macro2",
1865 | "quote",
1866 | "syn",
1867 | "wasm-bindgen-backend",
1868 | "wasm-bindgen-shared",
1869 | ]
1870 |
1871 | [[package]]
1872 | name = "wasm-bindgen-shared"
1873 | version = "0.2.93"
1874 | source = "registry+https://github.com/rust-lang/crates.io-index"
1875 | checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
1876 |
1877 | [[package]]
1878 | name = "web-sys"
1879 | version = "0.3.70"
1880 | source = "registry+https://github.com/rust-lang/crates.io-index"
1881 | checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0"
1882 | dependencies = [
1883 | "js-sys",
1884 | "wasm-bindgen",
1885 | ]
1886 |
1887 | [[package]]
1888 | name = "web-time"
1889 | version = "1.1.0"
1890 | source = "registry+https://github.com/rust-lang/crates.io-index"
1891 | checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
1892 | dependencies = [
1893 | "js-sys",
1894 | "wasm-bindgen",
1895 | ]
1896 |
1897 | [[package]]
1898 | name = "whoami"
1899 | version = "1.5.2"
1900 | source = "registry+https://github.com/rust-lang/crates.io-index"
1901 | checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d"
1902 | dependencies = [
1903 | "redox_syscall",
1904 | "wasite",
1905 | "web-sys",
1906 | ]
1907 |
1908 | [[package]]
1909 | name = "winapi"
1910 | version = "0.3.9"
1911 | source = "registry+https://github.com/rust-lang/crates.io-index"
1912 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
1913 | dependencies = [
1914 | "winapi-i686-pc-windows-gnu",
1915 | "winapi-x86_64-pc-windows-gnu",
1916 | ]
1917 |
1918 | [[package]]
1919 | name = "winapi-i686-pc-windows-gnu"
1920 | version = "0.4.0"
1921 | source = "registry+https://github.com/rust-lang/crates.io-index"
1922 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
1923 |
1924 | [[package]]
1925 | name = "winapi-util"
1926 | version = "0.1.9"
1927 | source = "registry+https://github.com/rust-lang/crates.io-index"
1928 | checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
1929 | dependencies = [
1930 | "windows-sys 0.59.0",
1931 | ]
1932 |
1933 | [[package]]
1934 | name = "winapi-x86_64-pc-windows-gnu"
1935 | version = "0.4.0"
1936 | source = "registry+https://github.com/rust-lang/crates.io-index"
1937 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
1938 |
1939 | [[package]]
1940 | name = "windows"
1941 | version = "0.52.0"
1942 | source = "registry+https://github.com/rust-lang/crates.io-index"
1943 | checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
1944 | dependencies = [
1945 | "windows-core",
1946 | "windows-targets",
1947 | ]
1948 |
1949 | [[package]]
1950 | name = "windows-core"
1951 | version = "0.52.0"
1952 | source = "registry+https://github.com/rust-lang/crates.io-index"
1953 | checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
1954 | dependencies = [
1955 | "windows-targets",
1956 | ]
1957 |
1958 | [[package]]
1959 | name = "windows-sys"
1960 | version = "0.52.0"
1961 | source = "registry+https://github.com/rust-lang/crates.io-index"
1962 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
1963 | dependencies = [
1964 | "windows-targets",
1965 | ]
1966 |
1967 | [[package]]
1968 | name = "windows-sys"
1969 | version = "0.59.0"
1970 | source = "registry+https://github.com/rust-lang/crates.io-index"
1971 | checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
1972 | dependencies = [
1973 | "windows-targets",
1974 | ]
1975 |
1976 | [[package]]
1977 | name = "windows-targets"
1978 | version = "0.52.6"
1979 | source = "registry+https://github.com/rust-lang/crates.io-index"
1980 | checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
1981 | dependencies = [
1982 | "windows_aarch64_gnullvm",
1983 | "windows_aarch64_msvc",
1984 | "windows_i686_gnu",
1985 | "windows_i686_gnullvm",
1986 | "windows_i686_msvc",
1987 | "windows_x86_64_gnu",
1988 | "windows_x86_64_gnullvm",
1989 | "windows_x86_64_msvc",
1990 | ]
1991 |
1992 | [[package]]
1993 | name = "windows_aarch64_gnullvm"
1994 | version = "0.52.6"
1995 | source = "registry+https://github.com/rust-lang/crates.io-index"
1996 | checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
1997 |
1998 | [[package]]
1999 | name = "windows_aarch64_msvc"
2000 | version = "0.52.6"
2001 | source = "registry+https://github.com/rust-lang/crates.io-index"
2002 | checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
2003 |
2004 | [[package]]
2005 | name = "windows_i686_gnu"
2006 | version = "0.52.6"
2007 | source = "registry+https://github.com/rust-lang/crates.io-index"
2008 | checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
2009 |
2010 | [[package]]
2011 | name = "windows_i686_gnullvm"
2012 | version = "0.52.6"
2013 | source = "registry+https://github.com/rust-lang/crates.io-index"
2014 | checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
2015 |
2016 | [[package]]
2017 | name = "windows_i686_msvc"
2018 | version = "0.52.6"
2019 | source = "registry+https://github.com/rust-lang/crates.io-index"
2020 | checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
2021 |
2022 | [[package]]
2023 | name = "windows_x86_64_gnu"
2024 | version = "0.52.6"
2025 | source = "registry+https://github.com/rust-lang/crates.io-index"
2026 | checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
2027 |
2028 | [[package]]
2029 | name = "windows_x86_64_gnullvm"
2030 | version = "0.52.6"
2031 | source = "registry+https://github.com/rust-lang/crates.io-index"
2032 | checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
2033 |
2034 | [[package]]
2035 | name = "windows_x86_64_msvc"
2036 | version = "0.52.6"
2037 | source = "registry+https://github.com/rust-lang/crates.io-index"
2038 | checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
2039 |
2040 | [[package]]
2041 | name = "winnow"
2042 | version = "0.6.20"
2043 | source = "registry+https://github.com/rust-lang/crates.io-index"
2044 | checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b"
2045 | dependencies = [
2046 | "memchr",
2047 | ]
2048 |
2049 | [[package]]
2050 | name = "wyz"
2051 | version = "0.5.1"
2052 | source = "registry+https://github.com/rust-lang/crates.io-index"
2053 | checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed"
2054 | dependencies = [
2055 | "tap",
2056 | ]
2057 |
2058 | [[package]]
2059 | name = "yansi-term"
2060 | version = "0.1.2"
2061 | source = "registry+https://github.com/rust-lang/crates.io-index"
2062 | checksum = "fe5c30ade05e61656247b2e334a031dfd0cc466fadef865bdcdea8d537951bf1"
2063 | dependencies = [
2064 | "winapi",
2065 | ]
2066 |
2067 | [[package]]
2068 | name = "zerocopy"
2069 | version = "0.7.35"
2070 | source = "registry+https://github.com/rust-lang/crates.io-index"
2071 | checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
2072 | dependencies = [
2073 | "byteorder",
2074 | "zerocopy-derive",
2075 | ]
2076 |
2077 | [[package]]
2078 | name = "zerocopy-derive"
2079 | version = "0.7.35"
2080 | source = "registry+https://github.com/rust-lang/crates.io-index"
2081 | checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
2082 | dependencies = [
2083 | "proc-macro2",
2084 | "quote",
2085 | "syn",
2086 | ]
2087 |
--------------------------------------------------------------------------------
/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "pgx_ulid"
3 | publish = false
4 | version = "0.2.0"
5 |
6 | edition = "2021"
7 | rust-version = "1.81.0"
8 |
9 | [lib]
10 | crate-type = ["cdylib", "lib"]
11 |
12 | [[bin]]
13 | name = "pgrx_embed_pgx_ulid"
14 | path = "./src/bin/pgrx_embed.rs"
15 |
16 | [features]
17 | default = ["pg15"]
18 | pg14 = ["pgrx-tests/pg14", "pgrx/pg14"]
19 | pg15 = ["pgrx-tests/pg15", "pgrx/pg15"]
20 | pg16 = ["pgrx-tests/pg16", "pgrx/pg16"]
21 | pg17 = ["pgrx-tests/pg17", "pgrx/pg17"]
22 | pg_test = []
23 |
24 | [dependencies]
25 | inner_ulid = { package = "ulid", version = "1.1.3" }
26 | pgrx = "^0.12.7"
27 |
28 | [dev-dependencies]
29 | pgrx-tests = "^0.12.7"
30 |
31 | [profile.dev]
32 | panic = "unwind"
33 |
34 | [profile.release]
35 | codegen-units = 1
36 | lto = "fat"
37 | opt-level = 3
38 | panic = "unwind"
39 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | ARG PG_MAJOR
2 |
3 | FROM postgres:${PG_MAJOR}
4 |
5 | RUN apt-get update
6 |
7 | ENV build_deps ca-certificates \
8 | git \
9 | build-essential \
10 | libpq-dev \
11 | postgresql-server-dev-${PG_MAJOR} \
12 | curl \
13 | libreadline6-dev \
14 | zlib1g-dev
15 |
16 | RUN apt-get install -y --no-install-recommends $build_deps pkg-config cmake
17 |
18 | WORKDIR /home/postgres
19 |
20 | ENV HOME=/home/postgres
21 | ENV PATH=/home/postgres/.cargo/bin:$PATH
22 |
23 | RUN chown postgres:postgres /home/postgres
24 |
25 | USER postgres
26 |
27 | RUN \
28 | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal --default-toolchain 1.81.0 && \
29 | rustup --version && \
30 | rustc --version && \
31 | cargo --version
32 |
33 | # pgrx
34 | RUN cargo install cargo-pgrx --version 0.12.7 --locked
35 |
36 | RUN cargo pgrx init --pg${PG_MAJOR} $(which pg_config)
37 |
38 | USER root
39 |
40 | COPY . .
41 |
42 | RUN cargo pgrx install
43 |
44 | RUN chown -R postgres:postgres /home/postgres
45 | RUN chown -R postgres:postgres /usr/share/postgresql/${PG_MAJOR}/extension
46 | RUN chown -R postgres:postgres /usr/lib/postgresql/${PG_MAJOR}/lib
47 |
48 | USER postgres
49 |
50 | ENV POSTGRES_HOST_AUTH_METHOD=trust
51 | ENV USER=postgres
52 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2023 Pavan Kumar Sunkara
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # pgx_ulid
3 |
4 | A postgres extension to support [ulid][].
5 |
6 | 1. [Why should I use this?](#why-should-i-use-this)
7 | 2. [Why should I use ulid over uuid?](#why-should-i-use-ulid-over-uuid)
8 | 3. [Monotonicity](#monotonicity)
9 | 4. [Usage](#usage)
10 | 5. [Installation](#installation)
11 | 6. [Troubleshooting](#troubleshooting)
12 |
13 | ## Why should I use this?
14 |
15 | There are several different postgres extensions for [ulid][], but all of them have feature gaps. A good extension should have:
16 |
17 | - **Generator**: A generator function to generate [ulid][] identifiers.
18 | - **Binary**: Data be stored as binary and not text.
19 | - **Type**: A postgres type `ulid` which is displayed as [ulid][] text.
20 | - **Uuid**: Support for casting between UUID and [ulid][]
21 | - **Timestamp**: Support to cast an [ulid][] to a timestamp
22 | - **Monotonic**: Support [monotonicity][]
23 |
24 | | Name | Language | Generator | Binary | Type | UUID | Timestamp | Monotonic |
25 | | :-----------------------------------------------------------: | :------: | :-------: | :----: | :--: | :----: | :-------: | :-------: |
26 | | [`pgx_ulid`](https://github.com/pksunkara/pgx_ulid) | Rust | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
27 | | [`pgulid`](https://github.com/geckoboard/pgulid) | PL/pgSQL | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ |
28 | | [`pg_idkit`](https://github.com/VADOSWARE/pg_idkit) | Rust | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ |
29 | | [`uids-postgres`](https://github.com/spa5k/uids-postgres) | Rust | ✔️ | ⁉️[^1] | ❌ | ⁉️[^2] | ❌ | ❌ |
30 | | [`pgsql_ulid`](https://github.com/scoville/pgsql-ulid) | PL/pgSQL | ❌ | ⁉️[^1] | ❌ | ✔️ | ❌ | ❌ |
31 | | [`pg-ulid`](https://github.com/edoceo/pg-ulid) | C | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ |
32 | | [`ulid-postgres`](https://github.com/schinckel/ulid-postgres) | PL/pgSQL | ✔️ | ❌ | ✔️ | ❌ | ✔️ | ❌ |
33 | | [`pg_ulid`](https://github.com/iCyberon/pg_ulid) | Go | ✔️ | ❌ | ❌ | ❌ | ✔️ | ❌ |
34 | | [`pg_ulid`](https://github.com/RPG-18/pg_ulid) | C++ | ✔️ | ⁉️[^1] | ❌ | ✔️ | ❌ | ❌ |
35 |
36 | [^1]: You can convert the [ulid][] into `uuid` or `bytea` and store it like that.
37 | [^2]: Supports casting indirectly through `bytea`.
38 |
39 | ## Why should I use ulid over uuid?
40 |
41 | The main advantages are:
42 |
43 | * Indexes created over ULIDs are less fragmented compared to UUIDs due to the timestamp and [monotonicity][] that was encoded in the ULID when it was created.
44 | * ULIDs don't use special characters, so they can be used in URLs or even HTML.
45 | * ULIDs are shorter than UUIDs as they are comprised of 26 characters compared to UUIDs' 36 characters.
46 |
47 | This extension is approximately **30% faster** than both `pgcrypto`'s UUID and `pg_uuidv7`'s UUIDv7 when generating a million identifiers.
48 |
49 |
50 |
51 | ```
52 | ulid=# EXPLAIN ANALYSE SELECT gen_random_uuid() FROM generate_series(1, 1000000);
53 | QUERY PLAN
54 | -----------------------------------------------------------------------------------------------------------------------------------
55 | Function Scan on generate_series (cost=0.00..12500.00 rows=1000000 width=16) (actual time=46.630..1401.638 rows=1000000 loops=1)
56 | Planning Time: 0.020 ms
57 | Execution Time: 1430.364 ms
58 | (3 rows)
59 |
60 | ulid=# EXPLAIN ANALYSE SELECT uuid_generate_v7() FROM generate_series(1, 1000000);
61 | QUERY PLAN
62 | -----------------------------------------------------------------------------------------------------------------------------------
63 | Function Scan on generate_series (cost=0.00..12500.00 rows=1000000 width=16) (actual time=46.977..1427.477 rows=1000000 loops=1)
64 | Planning Time: 0.031 ms
65 | Execution Time: 1456.333 ms
66 | (3 rows)
67 |
68 | ulid=# EXPLAIN ANALYSE SELECT gen_ulid() FROM generate_series(1, 1000000);
69 | QUERY PLAN
70 | -----------------------------------------------------------------------------------------------------------------------------------
71 | Function Scan on generate_series (cost=0.00..12500.00 rows=1000000 width=32) (actual time=46.820..1070.447 rows=1000000 loops=1)
72 | Planning Time: 0.020 ms
73 | Execution Time: 1098.086 ms
74 | (3 rows)
75 | ```
76 |
77 |
78 |
79 | This extension is approximately **20% faster** than both `pgcrypto`'s UUID and `pg_uuidv7`'s UUIDv7 when generating and inserting a million identifiers.
80 |
81 |
82 |
83 | ```
84 | ulid=# EXPLAIN ANALYSE INSERT INTO uuid_keys(id) SELECT gen_random_uuid() FROM generate_series(1, 1000000);
85 | QUERY PLAN
86 | -----------------------------------------------------------------------------------------------------------------------------------------
87 | Insert on uuid_keys (cost=0.00..22500.00 rows=0 width=0) (actual time=2006.633..2006.634 rows=0 loops=1)
88 | -> Function Scan on generate_series (cost=0.00..12500.00 rows=1000000 width=16) (actual time=46.846..1459.869 rows=1000000 loops=1)
89 | Planning Time: 0.029 ms
90 | Execution Time: 2008.195 ms
91 | (4 rows)
92 |
93 | ulid=# EXPLAIN ANALYSE INSERT INTO uuid7_keys(id) SELECT uuid_generate_v7() FROM generate_series(1, 1000000);
94 | QUERY PLAN
95 | -----------------------------------------------------------------------------------------------------------------------------------------
96 | Insert on uuid7_keys (cost=0.00..22500.00 rows=0 width=0) (actual time=2030.731..2030.731 rows=0 loops=1)
97 | -> Function Scan on generate_series (cost=0.00..12500.00 rows=1000000 width=16) (actual time=46.894..1479.223 rows=1000000 loops=1)
98 | Planning Time: 0.030 ms
99 | Execution Time: 2032.296 ms
100 | (4 rows)
101 |
102 | ulid=# EXPLAIN ANALYSE INSERT INTO ulid_keys(id) SELECT gen_ulid() FROM generate_series(1, 1000000);
103 | QUERY PLAN
104 | -----------------------------------------------------------------------------------------------------------------------------------------
105 | Insert on ulid_keys (cost=0.00..22500.00 rows=0 width=0) (actual time=1665.380..1665.380 rows=0 loops=1)
106 | -> Function Scan on generate_series (cost=0.00..12500.00 rows=1000000 width=32) (actual time=46.719..1140.979 rows=1000000 loops=1)
107 | Planning Time: 0.029 ms
108 | Execution Time: 1666.867 ms
109 | (4 rows)
110 | ```
111 |
112 |
113 |
114 | ## Monotonicity
115 |
116 | This extension supports [monotonicity][] through `gen_monotonic_ulid()` function. To achive this, it uses PostgreSQL's shared memory and LWLock to store last generated ULID.
117 |
118 | To be able to use [monotonic][monotonicity] ULID's, it is necessary to add this extension to `postgresql.conf`'s `shared_preload_libraries` configuration setting.
119 |
120 | ```conf
121 | shared_preload_libraries = 'pgx_ulid' # (change requires restart)
122 | ```
123 |
124 |
125 |
126 | ```
127 | ulid=# EXPLAIN ANALYSE SELECT gen_ulid() FROM generate_series(1, 1000000);
128 | QUERY PLAN
129 | -----------------------------------------------------------------------------------------------------------------------------------
130 | Function Scan on generate_series (cost=0.00..12500.00 rows=1000000 width=32) (actual time=47.207..2908.978 rows=1000000 loops=1)
131 | Planning Time: 0.035 ms
132 | Execution Time: 4053.482 ms
133 | (3 rows)
134 |
135 | ulid=# EXPLAIN ANALYSE SELECT gen_monotonic_ulid() FROM generate_series(1, 1000000);
136 | QUERY PLAN
137 | -----------------------------------------------------------------------------------------------------------------------------------
138 | Function Scan on generate_series (cost=0.00..12500.00 rows=1000000 width=32) (actual time=46.479..2586.654 rows=1000000 loops=1)
139 | Planning Time: 0.037 ms
140 | Execution Time: 3693.901 ms
141 | (3 rows)
142 | ```
143 |
144 |
145 |
146 |
147 |
148 | ```
149 | ulid=# EXPLAIN ANALYZE INSERT INTO users (name) SELECT 'Client 1' FROM generate_series(1, 1000000);
150 | QUERY PLAN
151 | -----------------------------------------------------------------------------------------------------------------------------------------
152 | Insert on users (cost=0.00..12500.00 rows=0 width=0) (actual time=8418.257..8418.261 rows=0 loops=1)
153 | -> Function Scan on generate_series (cost=0.00..12500.00 rows=1000000 width=64) (actual time=99.804..3013.333 rows=1000000 loops=1)
154 | Planning Time: 0.066 ms
155 | Execution Time: 8419.571 ms
156 | (4 rows)
157 |
158 | ulid=# EXPLAIN ANALYZE INSERT INTO users (name) SELECT 'Client 2' FROM generate_series(1, 1000000);
159 | QUERY PLAN
160 | -----------------------------------------------------------------------------------------------------------------------------------------
161 | Insert on users (cost=0.00..12500.00 rows=0 width=0) (actual time=8359.558..8359.561 rows=0 loops=1)
162 | -> Function Scan on generate_series (cost=0.00..12500.00 rows=1000000 width=64) (actual time=64.449..2976.754 rows=1000000 loops=1)
163 | Planning Time: 0.090 ms
164 | Execution Time: 8360.840 ms
165 | (4 rows)
166 | ```
167 |
168 |
169 |
170 |
171 | ### Pros
172 |
173 | 1. Monotonic ULIDs are better for indexing, as they are sorted by default.
174 | 2. Monotonic ULIDs slightly faster than `gen_ulid()` when generating lots of ULIDs within one millisecond. Because, in this case, there is no need to generate random component of ULID. Instead it is just incremented.
175 |
176 |
177 | ### Cons
178 |
179 | 1. Previously generated ULID is saved in shmem and accessed via LWLock. i.e. it is exclusive for function invocation within database. Theoretically this can lead to slowdowns.
180 |
181 | *...But, in practice (at least in our testing) `gen_monotonic_ulid()` is slightly faster than `gen_ulid()`.*
182 |
183 | 2. Extensions that use shared memory must be loaded via `postgresql.conf`'s `shared_preload_libraries` configuration setting.
184 |
185 | *...But, it only affects `gen_monotonic_ulid()` function. Other functions of this extension will work normally even without this config.*
186 |
187 | 3. Monotonic ULIDs may overflow and throw an error.
188 |
189 | *...But, chances are negligible.*
190 |
191 | ## Usage
192 |
193 | Use the extension in the database:
194 |
195 | ```sql
196 | CREATE EXTENSION ulid;
197 | -- or try "CREATE EXTENSION pgx_ulid;" if installed manually
198 | ```
199 |
200 | Create a table with [ulid][] as a primary key:
201 |
202 | ```sql
203 | CREATE TABLE users (
204 | id ulid NOT NULL DEFAULT gen_ulid() PRIMARY KEY,
205 | name text NOT NULL
206 | );
207 | ```
208 |
209 | Or, create a table with [monotonic][monotonicity] [ulid][] as a primary key:
210 |
211 | ```sql
212 | CREATE TABLE users (
213 | id ulid NOT NULL DEFAULT gen_monotonic_ulid() PRIMARY KEY,
214 | name text NOT NULL
215 | );
216 | ```
217 |
218 | Operate it normally with text in queries:
219 |
220 | ```sql
221 | SELECT * FROM users WHERE id = '01ARZ3NDEKTSV4RRFFQ69G5FAV';
222 | ```
223 |
224 | Cast [ulid][] to timestamp:
225 |
226 | ```sql
227 | ALTER TABLE users
228 | ADD COLUMN created_at timestamp GENERATED ALWAYS AS (id::timestamp) STORED;
229 | ```
230 |
231 | Cast timestamp to [ulid][], this generates a zeroed ULID with the timestamp prefixed (TTTTTTTTTT0000000000000000):
232 |
233 | ```sql
234 | -- gets all users where the ID was created on 2023-09-15, without using another column and taking advantage of the index
235 | SELECT * FROM users WHERE id BETWEEN '2023-09-15'::timestamp::ulid AND '2023-09-16'::timestamp::ulid;
236 | ```
237 |
238 | ## Installation
239 |
240 | Use [pgrx][]. You can clone this repo and install this extension locally by following [this guide](https://github.com/tcdi/pgrx/blob/master/cargo-pgrx/README.md#installing-your-extension-locally).
241 |
242 | You can also download relevant installation packages from [releases](https://github.com/pksunkara/pgx_ulid/releases) page.
243 |
244 | ## Troubleshooting
245 |
246 | If you encounter the exclusive lock error while using `pgx_ulid`, follow these steps to resolve the issue:
247 |
248 | 1. Alter the system to set `shared_preload_libraries` to `pgx_ulid` by running the following SQL command:
249 |
250 | ```sql
251 | ALTER SYSTEM SET shared_preload_libraries = 'pgx_ulid';
252 | ```
253 |
254 | 2. Restart the PostgreSQL service to apply the changes. The command to restart PostgreSQL depends on your system.
255 | 3. Verify that `ulid` is successfully loaded into shared libraries by executing:
256 |
257 | ```sql
258 | SHOW shared_preload_libraries;
259 | ```
260 |
261 |
262 | ## Contributors
263 |
264 | Here is a list of [Contributors](http://github.com/pksunkara/pgx_ulid/contributors)
265 |
266 |
267 | ### TODO
268 |
269 |
270 | ## License
271 |
272 | MIT/X11
273 |
274 |
275 | ## Bug Reports
276 |
277 | Report [here](http://github.com/pksunkara/pgx_ulid/issues).
278 |
279 |
280 | ## Creator
281 |
282 | Pavan Kumar Sunkara (pavan.sss1991@gmail.com)
283 |
284 | Follow me on [github](https://github.com/users/follow?target=pksunkara), [twitter](http://twitter.com/pksunkara)
285 |
286 | [ulid]: https://github.com/ulid/spec
287 | [pgrx]: https://github.com/tcdi/pgrx
288 | [monotonicity]: https://github.com/ulid/spec#monotonicity
289 |
--------------------------------------------------------------------------------
/pgx_ulid.control:
--------------------------------------------------------------------------------
1 | comment = 'ulid type and methods'
2 | default_version = '@CARGO_VERSION@'
3 | module_pathname = '$libdir/pgx_ulid'
4 | relocatable = false
5 | superuser = true
6 |
--------------------------------------------------------------------------------
/src/bin/pgrx_embed.rs:
--------------------------------------------------------------------------------
1 | ::pgrx::pgrx_embed!();
2 |
--------------------------------------------------------------------------------
/src/lib.rs:
--------------------------------------------------------------------------------
1 | use core::ffi::CStr;
2 | use inner_ulid::Ulid as InnerUlid;
3 | use pg_sys::Datum as SysDatum;
4 | use pgrx::callconv::{ArgAbi, BoxRet};
5 | use pgrx::datum::Datum;
6 | use pgrx::{
7 | pg_shmem_init, pg_sys::Oid, prelude::*, rust_regtypein, shmem::*, PgLwLock, StringInfo, Uuid,
8 | };
9 | use std::time::{Duration, SystemTime};
10 |
11 | ::pgrx::pg_module_magic!();
12 |
13 | static SHARED_ULID: PgLwLock = PgLwLock::new();
14 |
15 | #[pg_guard]
16 | pub extern "C" fn _PG_init() {
17 | pg_shmem_init!(SHARED_ULID);
18 | }
19 |
20 | #[allow(non_camel_case_types)]
21 | #[derive(
22 | PostgresType, PostgresEq, PostgresHash, PostgresOrd, Debug, PartialEq, PartialOrd, Eq, Hash, Ord,
23 | )]
24 | #[inoutfuncs]
25 | #[bikeshed_postgres_type_manually_impl_from_into_datum]
26 | pub struct ulid(u128);
27 |
28 | impl InOutFuncs for ulid {
29 | #[inline]
30 | fn input(input: &CStr) -> Self
31 | where
32 | Self: Sized,
33 | {
34 | let val = input.to_str().unwrap();
35 |
36 | match InnerUlid::from_string(val) {
37 | Ok(inner) => ulid(inner.0),
38 | Err(err) => {
39 | ereport!(
40 | ERROR,
41 | PgSqlErrorCode::ERRCODE_INVALID_TEXT_REPRESENTATION,
42 | format!("invalid input syntax for type ulid: \"{val}\": {err}")
43 | );
44 | }
45 | }
46 | }
47 |
48 | #[inline]
49 | fn output(&self, buffer: &mut StringInfo) {
50 | buffer.push_str(&InnerUlid(self.0).to_string())
51 | }
52 | }
53 |
54 | impl IntoDatum for ulid {
55 | #[inline]
56 | fn into_datum(self) -> Option {
57 | self.0.to_ne_bytes().into_datum()
58 | }
59 |
60 | #[inline]
61 | fn type_oid() -> Oid {
62 | rust_regtypein::()
63 | }
64 | }
65 |
66 | impl FromDatum for ulid {
67 | #[inline]
68 | unsafe fn from_polymorphic_datum(datum: SysDatum, is_null: bool, typoid: Oid) -> Option
69 | where
70 | Self: Sized,
71 | {
72 | let bytes: &[u8] = FromDatum::from_polymorphic_datum(datum, is_null, typoid)?;
73 |
74 | let mut len_bytes = [0u8; 16];
75 | len_bytes.copy_from_slice(bytes);
76 |
77 | Some(ulid(u128::from_ne_bytes(len_bytes)))
78 | }
79 | }
80 |
81 | unsafe impl<'fcx> ArgAbi<'fcx> for ulid
82 | where
83 | Self: 'fcx,
84 | {
85 | unsafe fn unbox_arg_unchecked(arg: ::pgrx::callconv::Arg<'_, 'fcx>) -> Self {
86 | unsafe { arg.unbox_arg_using_from_datum().unwrap() }
87 | }
88 | }
89 |
90 | unsafe impl BoxRet for ulid {
91 | unsafe fn box_into<'fcx>(self, fcinfo: &mut pgrx::callconv::FcInfo<'fcx>) -> Datum<'fcx> {
92 | unsafe { fcinfo.return_raw_datum(self.into_datum().unwrap()) }
93 | }
94 | }
95 |
96 | #[pg_extern]
97 | fn gen_monotonic_ulid() -> ulid {
98 | let mut shared_bytes = SHARED_ULID.exclusive();
99 | let shared_ulid = InnerUlid::from(*shared_bytes);
100 | let new_ulid = if shared_ulid.is_nil()
101 | || SystemTime::now()
102 | .duration_since(SystemTime::UNIX_EPOCH)
103 | .unwrap_or(Duration::ZERO)
104 | .as_millis()
105 | > u128::from(shared_ulid.timestamp_ms())
106 | {
107 | InnerUlid::new()
108 | } else {
109 | shared_ulid.increment().unwrap()
110 | };
111 | *shared_bytes = u128::from(new_ulid);
112 | ulid(*shared_bytes)
113 | }
114 |
115 | #[pg_extern]
116 | fn gen_ulid() -> ulid {
117 | ulid(InnerUlid::new().0)
118 | }
119 |
120 | #[pg_extern(immutable, parallel_safe)]
121 | fn ulid_from_uuid(input: Uuid) -> ulid {
122 | let mut bytes = *input.as_bytes();
123 | bytes.reverse();
124 | ulid(u128::from_ne_bytes(bytes))
125 | }
126 |
127 | #[pg_extern(immutable, parallel_safe)]
128 | fn ulid_to_uuid(input: ulid) -> Uuid {
129 | let mut bytes = input.0.to_ne_bytes();
130 | bytes.reverse();
131 | Uuid::from_bytes(bytes)
132 | }
133 |
134 | #[pg_extern(immutable, parallel_safe)]
135 | fn ulid_to_bytea(input: ulid) -> Vec {
136 | let mut bytes = input.0.to_ne_bytes();
137 | bytes.reverse();
138 | bytes.to_vec()
139 | }
140 |
141 | #[pg_extern(immutable, parallel_safe)]
142 | fn ulid_to_timestamp(input: ulid) -> Timestamp {
143 | let inner_seconds = (InnerUlid(input.0).timestamp_ms() as f64) / 1000.0;
144 | to_timestamp(inner_seconds).into()
145 | }
146 |
147 | #[pg_extern(immutable, parallel_safe)]
148 | fn timestamp_to_ulid(input: Timestamp) -> ulid {
149 | let epoch: f64 = input
150 | .extract_part(DateTimeParts::Epoch)
151 | .unwrap()
152 | .try_into()
153 | .unwrap();
154 |
155 | let milliseconds = (epoch * 1000.0) as u64;
156 |
157 | let inner = InnerUlid::from_parts(milliseconds, 0);
158 |
159 | ulid(inner.0)
160 | }
161 |
162 | #[pg_extern(immutable, parallel_safe)]
163 | fn timestamptz_to_ulid(input: TimestampWithTimeZone) -> ulid {
164 | let epoch: f64 = input
165 | .extract_part(DateTimeParts::Epoch)
166 | .unwrap()
167 | .try_into()
168 | .unwrap();
169 |
170 | let milliseconds = (epoch * 1000.0) as u64;
171 |
172 | let inner = InnerUlid::from_parts(milliseconds, 0);
173 |
174 | ulid(inner.0)
175 | }
176 |
177 | extension_sql!(
178 | r#"
179 | CREATE CAST (uuid AS ulid) WITH FUNCTION ulid_from_uuid(uuid) AS IMPLICIT;
180 | CREATE CAST (ulid AS uuid) WITH FUNCTION ulid_to_uuid(ulid) AS IMPLICIT;
181 | CREATE CAST (ulid AS bytea) WITH FUNCTION ulid_to_bytea(ulid) AS IMPLICIT;
182 | CREATE CAST (ulid AS timestamp) WITH FUNCTION ulid_to_timestamp(ulid) AS IMPLICIT;
183 | CREATE CAST (timestamp AS ulid) WITH FUNCTION timestamp_to_ulid(timestamp) AS IMPLICIT;
184 | CREATE CAST (timestamptz AS ulid) WITH FUNCTION timestamptz_to_ulid(timestamptz) AS IMPLICIT;
185 | "#,
186 | name = "ulid_casts",
187 | requires = [
188 | ulid_from_uuid,
189 | ulid_to_uuid,
190 | ulid_to_bytea,
191 | ulid_to_timestamp,
192 | timestamp_to_ulid,
193 | timestamptz_to_ulid
194 | ]
195 | );
196 |
197 | #[cfg(any(test, feature = "pg_test"))]
198 | #[pg_schema]
199 | mod tests {
200 | use super::*;
201 |
202 | const INT: u128 = 2029121117734015635515926905565997019;
203 | const TEXT: &str = "01GV5PA9EQG7D82Q3Y4PKBZSYV";
204 | const UUID: &str = "0186cb65-25d7-81da-815c-7e25a6bfe7db";
205 | const BYTEA: &[u8] = &[
206 | 1, 134, 203, 101, 37, 215, 129, 218, 129, 92, 126, 37, 166, 191, 231, 219,
207 | ];
208 | const TIMESTAMP: &str = "2023-03-10 12:00:49.111";
209 |
210 | #[pg_test]
211 | fn test_null_to_ulid() {
212 | let result = Spi::get_one::("SELECT NULL::ulid;").unwrap();
213 | assert_eq!(None, result);
214 | }
215 |
216 | #[pg_test]
217 | fn test_string_to_ulid() {
218 | let result = Spi::get_one::(&format!("SELECT '{TEXT}'::ulid;")).unwrap();
219 | assert_eq!(Some(ulid(INT)), result);
220 | }
221 |
222 | #[pg_test]
223 | fn test_ulid_to_string() {
224 | let result = Spi::get_one::<&str>(&format!("SELECT '{TEXT}'::ulid::text;")).unwrap();
225 | assert_eq!(Some(TEXT), result);
226 | }
227 |
228 | #[pg_test]
229 | fn test_string_to_ulid_lowercase() {
230 | let result = Spi::get_one::(&format!("SELECT LOWER('{TEXT}')::ulid;")).unwrap();
231 | assert_eq!(Some(ulid(INT)), result);
232 | }
233 |
234 | #[pg_test]
235 | #[should_panic = "invalid input syntax for type ulid: \"01GV5PA9EQG7D82Q3Y4PKBZSY\": invalid length"]
236 | fn test_string_to_ulid_invalid_length() {
237 | let _ = Spi::get_one::("SELECT '01GV5PA9EQG7D82Q3Y4PKBZSY'::ulid;");
238 | }
239 |
240 | #[pg_test]
241 | #[should_panic = "invalid input syntax for type ulid: \"01GV5PA9EQG7D82Q3Y4PKBZSYU\": invalid character"]
242 | fn test_string_to_ulid_invalid_char() {
243 | let _ = Spi::get_one::("SELECT '01GV5PA9EQG7D82Q3Y4PKBZSYU'::ulid;");
244 | }
245 |
246 | #[pg_test]
247 | fn test_ulid_to_timestamp() {
248 | let result = Spi::get_one::<&str>(&format!(
249 | "SET TIMEZONE TO 'UTC'; SELECT '{TEXT}'::ulid::timestamp::text;"
250 | ))
251 | .unwrap();
252 | assert_eq!(Some(TIMESTAMP), result);
253 | }
254 |
255 | #[pg_test]
256 | fn test_timestamp_to_ulid() {
257 | let result = Spi::get_one::<&str>(&format!(
258 | "SET TIMEZONE TO 'UTC'; SELECT '{TIMESTAMP}'::timestamp::ulid::text;"
259 | ))
260 | .unwrap();
261 | assert_eq!(Some("01GV5PA9EQ0000000000000000"), result);
262 | }
263 |
264 | #[pg_test]
265 | fn test_timestamptz_to_ulid() {
266 | let result = Spi::get_one::<&str>(&format!(
267 | "SET TIMEZONE TO 'UTC'; SELECT '{TIMESTAMP}'::timestamptz::ulid::text;"
268 | ))
269 | .unwrap();
270 | assert_eq!(Some("01GV5PA9EQ0000000000000000"), result);
271 | }
272 |
273 | #[pg_test]
274 | fn test_ulid_to_uuid() {
275 | let result = Spi::get_one::<&str>(&format!("SELECT '{TEXT}'::ulid::uuid::text;")).unwrap();
276 | assert_eq!(Some(UUID), result);
277 | }
278 |
279 | #[pg_test]
280 | fn test_ulid_to_bytea() {
281 | let result = Spi::get_one::<&[u8]>(&format!("SELECT '{TEXT}'::ulid::bytea;")).unwrap();
282 |
283 | assert_eq!(Some(BYTEA), result);
284 | }
285 |
286 | #[pg_test]
287 | fn test_uuid_to_ulid() {
288 | let result = Spi::get_one::(&format!("SELECT '{UUID}'::uuid::ulid;")).unwrap();
289 | assert_eq!(Some(ulid(INT)), result);
290 | }
291 |
292 | #[pg_test]
293 | fn test_generate() {
294 | let result = Spi::get_one::("SELECT gen_ulid();").unwrap();
295 | assert!(result.is_some());
296 | }
297 |
298 | #[pg_test]
299 | fn test_hash() {
300 | Spi::run(
301 | "CREATE TABLE foo (
302 | id ulid,
303 | data TEXT
304 | );
305 |
306 | CREATE TABLE bar (
307 | id ulid,
308 | foo_id ulid
309 | );
310 |
311 | INSERT INTO foo DEFAULT VALUES;
312 | INSERT INTO bar DEFAULT VALUES;
313 |
314 | SELECT *
315 | FROM bar
316 | JOIN foo ON bar.id = foo.id;",
317 | )
318 | .unwrap();
319 | }
320 |
321 | #[pg_test]
322 | fn test_commutator() {
323 | Spi::run(
324 | "CREATE TABLE foo (
325 | id ulid,
326 | data TEXT
327 | );
328 |
329 | CREATE TABLE bar (
330 | id ulid
331 | );
332 |
333 | SELECT *
334 | FROM bar
335 | JOIN foo ON bar.id = foo.id;",
336 | )
337 | .unwrap();
338 | }
339 | }
340 |
341 | /// This module is required by `cargo pgrx test` invocations.
342 | /// It must be visible at the root of your extension crate.
343 | #[cfg(test)]
344 | pub mod pg_test {
345 | pub fn setup(_options: Vec<&str>) {
346 | // perform one-off initialization when the pg_test framework starts
347 | }
348 |
349 | #[must_use]
350 | pub fn postgresql_conf_options() -> Vec<&'static str> {
351 | // return any postgresql.conf settings that are required for your tests
352 | vec![]
353 | }
354 | }
355 |
--------------------------------------------------------------------------------