{"id":21883149,"url":"https://github.com/eendroroy/pg_semver","last_synced_at":"2025-08-01T15:33:32.062Z","repository":{"id":71992060,"uuid":"178878886","full_name":"eendroroy/pg_semver","owner":"eendroroy","description":"Version(SEMVER) data type for postgresql","archived":false,"fork":false,"pushed_at":"2020-01-02T16:38:17.000Z","size":91,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T11:36:30.675Z","etag":null,"topics":["postgresql","postgresql-data-type","postgresql-extension"],"latest_commit_sha":null,"homepage":"","language":"C","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/eendroroy.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}},"created_at":"2019-04-01T14:17:02.000Z","updated_at":"2024-01-23T14:07:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"c4b7bdd1-2738-4ce1-9127-93ffdf13ea5a","html_url":"https://github.com/eendroroy/pg_semver","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/eendroroy/pg_semver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eendroroy%2Fpg_semver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eendroroy%2Fpg_semver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eendroroy%2Fpg_semver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eendroroy%2Fpg_semver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eendroroy","download_url":"https://codeload.github.com/eendroroy/pg_semver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eendroroy%2Fpg_semver/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268250327,"owners_count":24219803,"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-08-01T02:00:08.611Z","response_time":67,"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":["postgresql","postgresql-data-type","postgresql-extension"],"created_at":"2024-11-28T09:39:29.151Z","updated_at":"2025-08-01T15:33:31.962Z","avatar_url":"https://github.com/eendroroy.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PG SEMVER\n\n[![GitHub tag](https://img.shields.io/github/tag/eendroroy/pg_semver.svg)](https://github.com/eendroroy/pg_semver/tags)\n\n[![Contributors](https://img.shields.io/github/contributors/eendroroy/pg_semver.svg)](https://github.com/eendroroy/pg_semver/graphs/contributors)\n[![GitHub last commit (branch)](https://img.shields.io/github/last-commit/eendroroy/pg_semver/master.svg)](https://github.com/eendroroy/pg_semver)\n[![license](https://img.shields.io/github/license/eendroroy/pg_semver.svg)](https://github.com/eendroroy/pg_semver/blob/master/LICENSE)\n[![GitHub issues](https://img.shields.io/github/issues/eendroroy/pg_semver.svg)](https://github.com/eendroroy/pg_semver/issues)\n[![GitHub closed issues](https://img.shields.io/github/issues-closed/eendroroy/pg_semver.svg)](https://github.com/eendroroy/pg_semver/issues?q=is%3Aissue+is%3Aclosed)\n[![GitHub pull requests](https://img.shields.io/github/issues-pr/eendroroy/pg_semver.svg)](https://github.com/eendroroy/pg_semver/pulls)\n[![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/eendroroy/pg_semver.svg)](https://github.com/eendroroy/pg_semver/pulls?q=is%3Apr+is%3Aclosed)\n\n**`Version`** Data type (`SEMVER`) for postgresql.\n\nIt enables `Version` to be inserted into tables as data type (`CREATE TABLE versions(version SEMVER);`).\n\nSupported operations:\n- `=`\n- `\u003c\u003e`\n- `\u003e`\n- `\u003e=`\n- `\u003c`\n- `\u003c=`\n- `~`\n```\n  ~1.2.3 := \u003e=1.2.3 \u003c1.(2+1).0 := \u003e=1.2.3 \u003c1.3.0\n  ~0.2.3 := \u003e=0.2.3 \u003c0.(2+1).0 := \u003e=0.2.3 \u003c0.3.0\n```\n- `!~`\n- `^`\n```\n  ^1.2.3 := \u003e=1.2.3 \u003c2.0.0\n  ^0.2.3 := \u003e=0.2.3 \u003c0.3.0\n  ^0.0.3 := \u003e=0.0.0 \u003c0.1.0\n```\n- `!^`\n\n## Example\n\nMore examples are available in **[test/sql](test/sql)** directory.\n\n```sql\nCREATE TABLE versions(version SEMVER);\n\nINSERT INTO versions VALUES ('1.0.0'), ('0.0.0'), ('2.5.0-beta1'), ('2.0.0-rc1'), ('2.10.0-beta0'), \n                            ('20.2.0-alpha'), ('30.0.0'), ('3.0.0'), ('3.0.0-rc2'), ('3.0.0-rc0'),\n                            ('3.0.0-beta2'), ('3.0.0-alpha0');\n\nSELECT * FROM versions WHERE version = '1.0.0';\n version \n---------\n 1.0.0\n(1 row)\n\nSELECT * FROM versions WHERE version \u003e '2.9-beta1';\n   version    \n--------------\n 2.10.0-beta0\n 20.2.0-alpha\n 30.0.0\n 3.0.0\n 3.0.0-rc2\n 3.0.0-rc0\n 3.0.0-beta2\n 3.0.0-alpha0\n(8 rows)\n\nSELECT * FROM versions ORDER BY version DESC;\n   version    \n--------------\n 30.0.0\n 20.2.0-alpha\n 3.0.0\n 3.0.0-rc2\n 3.0.0-rc0\n 3.0.0-beta2\n 3.0.0-alpha0\n 2.10.0-beta0\n 2.5.0-beta1\n 2.0.0-rc1\n 1.0.0\n 0.0.0\n(12 rows)\n```\n\n**2 versions can also be compared without inserting into any table:**\n\n```sql\nSELECT PG_SEMVER_CMP('1.0.0-alpha.1', '1.0.0-alpha.2');\n pg_semver_cmp \n---------------\n            -1\n(1 row)\n\nSELECT PG_SEMVER_CMP('0.0.1', '0.0.1');\n pg_semver_cmp \n---------------\n             0\n(1 row)\n\nSELECT PG_SEMVER_CMP('0.0.2', '0.0.1');\n pg_semver_cmp \n---------------\n             1\n(1 row)\n```\n\n## Installing by compiling source code\n\n**Prerequisites**\n\n`Ubuntu`:\n\n```bash\n# add postgres repo\nadd-apt-repository 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main'\nwget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -\n\n# install postgres\napt-get -y update\napt-get -y install postgresql postgresql-contrib libpq-dev postgresql-server-dev-all\n\n# install build requirements\napt-get -y install make build-essential\n```\n\n`RHEL`:\n\n```bash\nyum -y install openssl-devel\n\n# add postgres repo\nrpm -Uvh https://yum.postgresql.org/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm\n\n# install postgres\nyum -y install postgresql10-server postgresql10-libs postgresql10-devel postgresql10-contrib\n\n# initialize databasse\n/usr/pgsql-10/bin/postgresql-10-setup initdb\n```\n\n**Build**\n\n```bash\nmake\nmake install\n```\n\nIf you encounter an error such as:\n\n```\nmake: pg_config: Command not found\n```\n\nBe sure that you have pg_config installed and in your path. If you used \na package management system such as RPM to install PostgreSQL, be sure \nthat the -devel package is also installed. If necessary tell the build \nprocess where to find it. Edit Makefile, and change PG_CONFIG variable:\n\n```bash\nPG_CONFIG=/path/to/pg_config\n```\n\nfollowed by the\n\n```bash\nmake\nmake install\n```\n\n`pg_config` is usually under `/usr/pgsql-10/bin/pg_config` on \nRHEL/CentOS/Fedora. Replace 10 with your major PostgreSQL version.\n\nAlternatively the following will work too:\n\n```bash\nPATH=\"/usr/pgsql-10/bin:$PATH\" make\nsudo PATH=\"/usr/pgsql-10/bin:$PATH\" make install\nPATH=\"/usr/pgsql-10/bin:$PATH\" make installcheck\n```\n\n## Using the module\n\nTo enable this module, add '`$libdir/pg_semver`' to shared_preload_libraries in postgresql.conf, then restart the server.\n\n## Testing\n\nUsing vagrant:\n\n```bash\nvagrant up\nvagrant provision --provision-with install\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at [pg_semver](https://github.com/eendroroy/pg_semver) repository.\nThis project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the\n[Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n  1. Fork it ( https://github.com/eendroroy/pg_semver/fork )\n  1. Create your feature branch (`git checkout -b my-new-feature`)\n  1. Commit your changes (`git commit -am 'Add some feature'`)\n  1. Push to the branch (`git push origin my-new-feature`)\n  1. Create a new Pull Request\n\n## Author\n\n* **indrajit** - *Owner* - [eendroroy](https://github.com/eendroroy)\n\n## License\n\nThe project is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feendroroy%2Fpg_semver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feendroroy%2Fpg_semver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feendroroy%2Fpg_semver/lists"}