{"id":22553259,"url":"https://github.com/ishaanadarsh/pg_sample_ext","last_synced_at":"2025-10-08T05:47:50.837Z","repository":{"id":178370156,"uuid":"661772760","full_name":"IshaanAdarsh/pg_sample_ext","owner":"IshaanAdarsh","description":"pg_sample_ext is a PostgreSQL extension that provides a sample function to demonstrate extending PostgreSQL's functionality. ","archived":false,"fork":false,"pushed_at":"2023-07-12T14:38:04.000Z","size":41,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-22T07:42:53.222Z","etag":null,"topics":["extension","gsoc","postgresql","postgresql-extension","sql"],"latest_commit_sha":null,"homepage":"https://pgxn.org/dist/pg_sample_ext/1.0.2/","language":"PLpgSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IshaanAdarsh.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"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-07-03T15:58:11.000Z","updated_at":"2024-06-26T16:35:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"312e646b-2483-4498-8fa2-5cd26c2f62be","html_url":"https://github.com/IshaanAdarsh/pg_sample_ext","commit_stats":null,"previous_names":["ishaanadarsh/pg_sample_ext"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/IshaanAdarsh/pg_sample_ext","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IshaanAdarsh%2Fpg_sample_ext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IshaanAdarsh%2Fpg_sample_ext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IshaanAdarsh%2Fpg_sample_ext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IshaanAdarsh%2Fpg_sample_ext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IshaanAdarsh","download_url":"https://codeload.github.com/IshaanAdarsh/pg_sample_ext/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IshaanAdarsh%2Fpg_sample_ext/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278896739,"owners_count":26064772,"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-10-08T02:00:06.501Z","response_time":56,"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":["extension","gsoc","postgresql","postgresql-extension","sql"],"created_at":"2024-12-07T18:08:59.112Z","updated_at":"2025-10-08T05:47:50.831Z","avatar_url":"https://github.com/IshaanAdarsh.png","language":"PLpgSQL","readme":"# pg_sample_ext\n\npg_sample_ext is a PostgreSQL extension that provides a sample function to demonstrate extending PostgreSQL's functionality.\n\n## Installation\n\n1. Make sure you have PostgreSQL installed and running.\n\n2. Clone or download the repository [pg_sample_ext](https://github.com/IshaanAdarsh/pg_sample_ext/tree/main) to your local machine.\n\n3. Change to the extension directory:\n\n```\n$ cd pg_sample_ext\n```\n\n4. Build and install the extension:\n\n    $ make\n    $ make install\n\n5. Enable the extension: \n\n`CREATE EXTENSION pg_sample_ext;`\n\n## Usage\n\nOnce the `pg_sample_ext` extension is installed and upgraded to version 1.0.1, you can use the included functions and new features in your SQL queries.\n\n### square\n\nThe `square` function calculates the square of a number.\n\n```\nSELECT square(5);  -- Returns 25\n```\n\n### Composite Type (person_type): \n- The extension now includes a composite type named `person_type` that represents a person's name and age. This allows for more structured data storage and retrieval.\n- Insert a row with a value from the composite type\n\n```\nINSERT INTO my_table (person) VALUES (('John Doe', 30));\n```\n\n\n### Enumerated Type (status_type):\n- A new enumerated type called `status_type` is introduced, which provides a predefined set of values for representing different statuses. This enhances data integrity and enables more meaningful data classification.\n- Insert a row with a value from the enumerated type\n\n```\nINSERT INTO status_table (status) VALUES ('active');\n```\n\n### Domain Type (positive_integer): \n- The extension now includes a domain type called `positive_integer`, which is a specialized data type that represents positive integers. This allows for better constraint enforcement and data validation.\n- Insert a row, ensuring the quantity is a positive integer\n\n```\nINSERT INTO quant_table (quantity) VALUES (10);\n```\n\n###  Custom Operator (@*):\n- The extension introduces a custom operator `@*` that performs a custom operation, such as multiplication, on values of a specific type.\n-- It multiplies two values of type my_type and returns a value of the same type.\n\n```\nSELECT ROW(2)::my_type @* ROW(3)::my_type AS result;\n```\n\n### Contributing\n\nContributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository [pg_sample_ext](https://github.com/IshaanAdarsh/pg_sample_ext/tree/main).\n\n## License\n\nThis project is licensed under the [PostgreSQL License](LICENSE).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fishaanadarsh%2Fpg_sample_ext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fishaanadarsh%2Fpg_sample_ext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fishaanadarsh%2Fpg_sample_ext/lists"}