{"id":26469975,"url":"https://github.com/kaznak/pgx_uuidv7","last_synced_at":"2025-07-29T04:08:36.627Z","repository":{"id":202699955,"uuid":"705996281","full_name":"kaznak/pgx_uuidv7","owner":"kaznak","description":"An extension for PostgreSQL that implements UUIDv7 with basic features.","archived":false,"fork":false,"pushed_at":"2025-07-25T02:13:56.000Z","size":86,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-25T05:00:44.227Z","etag":null,"topics":["pgrx","postgres","postgresql","postgresql-extension","uuid","uuidv7"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaznak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-10-17T05:29:41.000Z","updated_at":"2025-07-25T02:13:38.000Z","dependencies_parsed_at":"2025-06-25T19:42:47.439Z","dependency_job_id":null,"html_url":"https://github.com/kaznak/pgx_uuidv7","commit_stats":null,"previous_names":["kaznak/pgx_uuidv7"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/kaznak/pgx_uuidv7","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaznak%2Fpgx_uuidv7","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaznak%2Fpgx_uuidv7/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaznak%2Fpgx_uuidv7/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaznak%2Fpgx_uuidv7/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaznak","download_url":"https://codeload.github.com/kaznak/pgx_uuidv7/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaznak%2Fpgx_uuidv7/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267626957,"owners_count":24117708,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pgrx","postgres","postgresql","postgresql-extension","uuid","uuidv7"],"created_at":"2025-03-19T17:09:57.542Z","updated_at":"2025-07-29T04:08:36.622Z","avatar_url":"https://github.com/kaznak.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pgx_uuidv7\n\nAn extension for PostgreSQL that implements UUIDv7 with basic features.\n\n## Features\n\n- Generate or Cast to UUIDv7\n- Cast from UUIDv7 to timestamptz\n- PostgreSQL 18 compatibility (provides compatible function names)\n\n## Examples\n\n### Simple Generation\n\nGenerate for present time:\n\n```sql\nSELECT uuid_generate_v7_now();\n```\n\nGenerate for specific time:\n\n```sql\nSELECT uuid_generate_v7('2012-03-04T05:06:07.123456789+00:00');\n```\n\nGenerate with interval offset from current time:\n\n```sql\nSELECT uuid_generate_v7_at_interval(INTERVAL '-1 hour');  -- 1 hour ago\nSELECT uuid_generate_v7_at_interval(INTERVAL '30 minutes');  -- 30 minutes from now\n```\n\n### Cast to compare with timestamptz\n\nPreparation:\n\n```sql\nCREATE TABLE foo (\n  id uuid,\n  data TEXT\n);\n\nCREATE TABLE bar (\n  id uuid default uuid_generate_v7_now(),\n  foo_id uuid\n);\n\nINSERT INTO foo\nvalues (\n  uuid_generate_v7('2012-03-04T05:06:07.123456789+00:00'),\n  'a'\n), (\n  uuid_generate_v7('2001-12-03T04:05:06.123456789+00:00'),\n  'b'\n);\n\nINSERT INTO bar (foo_id) SELECT id FROM foo;\n```\n\nCheck equality:\n\n```sql\nSELECT data\nFROM bar\nJOIN foo ON bar.foo_id = foo.id\nWHERE foo.id::timestamptz = '2012-03-04T05:06:07.123+00:00';\n```\n\nNarrow down by range:\n\n```sql\nSELECT data\nFROM bar\nJOIN foo ON bar.foo_id = foo.id\nWHERE foo.id::timestamptz \u003c '2012-03-04T05:06:07.123+00:00';\n```\n\n## PostgreSQL 18 Compatibility\n\nThis extension provides PostgreSQL 18 compatible function names as aliases:\n\n```sql\n-- PostgreSQL 18 compatible functions (available only when targeting PostgreSQL \u003c 18)\nSELECT uuidv7();                           -- alias for uuid_generate_v7_now()\nSELECT uuidv7(INTERVAL '-1 hour');         -- generate UUID with timestamp offset\nSELECT uuid_extract_version(some_uuid);   -- alias for uuid_get_version()\nSELECT uuid_extract_timestamp(some_uuid); -- alias for uuid_to_timestamptz()\n```\n\n**Note**: These PostgreSQL 18 compatible functions are automatically excluded when building for PostgreSQL 18 to avoid conflicts with native functions. They are only available when targeting PostgreSQL versions prior to 18.\n\nThis allows for easy migration to PostgreSQL 18 when it becomes available.\n\n## References\n\nuses:\n\n- [pgrx v0.11.0](https://github.com/pgcentralfoundation/pgrx)([docs](https://docs.rs/pgrx/0.11.0/pgrx/index.html))\n    - install this into your environment to develop this extension.\n- uuid([docs](https://docs.rs/uuid/1.4.1/uuid/index.html))\n\nlots of code is copied and modified from these following repositories:\n\n- [pg_uuidv7](https://github.com/craigpastro/pg_uuidv7)\n- [pgx_ulid](https://github.com/pksunkara/pgx_ulid)\n\nThank you.\n\n## Memo\n\n### Build commands\n\n```bash\nPG_VERSION=16 # set postgresql major version\ncargo pgrx package --no-default-features --features pg$PG_VERSION --pg-config $(ls ~/.pgrx/$PG_VERSION.*/pgrx-install/bin/pg_config 2\u003e/dev/null | tail -n1)\n```\n\n**Note**: When building for PostgreSQL 18 (`--features pg18`), the PostgreSQL 18 compatible functions (`uuidv7()`, `uuid_extract_version()`, `uuid_extract_timestamp()`) will be automatically excluded to prevent conflicts with PostgreSQL 18's native UUIDv7 functions.\n\n## Release Workflow\n\nThis project uses GitHub Actions for automated releases:\n\n### Creating a Release\n\n#### 1. Prepare Release\n\nBefore creating a release, update the version:\n\n**Update version in `Cargo.toml`:**\n```toml\n[package]\nversion = \"0.1.4\"  # Update to new version\n```\n\n**Commit the version update:**\n```bash\ngit add Cargo.toml\ngit commit -m \"chore: bump version to 0.1.4\"\ngit push\n```\n\n#### 2. Create and Push Tag\n\n```bash\ngit tag v0.1.4\ngit push origin v0.1.4\n```\n\n#### 3. Monitor Automatic Build\n\nThe workflow will automatically:\n- Build packages for PostgreSQL 16 and 17\n- Create Debian packages (`.deb` files)\n- Generate a draft release on GitHub with auto-generated release notes\n\n**Wait for workflow completion:**\n- Go to the [Actions tab](https://github.com/kaznak/pgx_uuidv7/actions) on GitHub\n- Monitor the \"Release\" workflow triggered by your tag\n- Ensure all jobs complete successfully (✅)\n- If any job fails (❌), investigate and fix the issues before proceeding\n\n#### 4. Review and Verify Release\n\nBefore publishing, verify the build results:\n\n**Check the draft release:**\n- Go to GitHub Releases page\n- Confirm the draft release was created with your tag version\n- Verify both packages are attached:\n  - `pgx-uuidv7-16-amd64-linux-gnu.deb`\n  - `pgx-uuidv7-17-amd64-linux-gnu.deb`\n\n**Optional: Test the packages locally:**\n```bash\n# Download and test one of the packages\nwget https://github.com/kaznak/pgx_uuidv7/releases/download/v0.1.4/pgx-uuidv7-16-amd64-linux-gnu.deb\n# Test installation in a clean environment\n```\n\n#### 5. Complete Release\n\n- **Write release notes directly on GitHub** describing:\n  - New features\n  - Bug fixes\n  - Breaking changes (if any)\n  - Installation/upgrade instructions\n  - Known issues (if any)\n- **Review all information one final time**\n- Click \"Publish release\" to make it public\n\n### Supported PostgreSQL Versions\n\nThe release workflow builds packages for:\n- PostgreSQL 16 (`pgx-uuidv7-16-amd64-linux-gnu.deb`)\n- PostgreSQL 17 (`pgx-uuidv7-17-amd64-linux-gnu.deb`)\n\n### Release Notes\n\nRelease notes are written directly on GitHub during the release process. The workflow automatically generates initial notes from recent commits and PRs, which can then be edited to provide clear, user-friendly descriptions of changes.\n\n###  OSSP UUID library is not well maintained.\n\nhttps://www.postgresql.org/docs/16/uuid-ossp.html#UUID-OSSP-BUILDING\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaznak%2Fpgx_uuidv7","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaznak%2Fpgx_uuidv7","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaznak%2Fpgx_uuidv7/lists"}