{"id":20442587,"url":"https://github.com/masonm/postgres_select_tracker","last_synced_at":"2025-07-09T23:04:23.376Z","repository":{"id":146551355,"uuid":"116355597","full_name":"MasonM/postgres_select_tracker","owner":"MasonM","description":"PL/pgSQL functions to record selected rows to a separate table","archived":false,"fork":false,"pushed_at":"2018-01-11T05:37:08.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-24T01:47:44.547Z","etag":null,"topics":["plpgsql","postgresql"],"latest_commit_sha":null,"homepage":null,"language":"PLpgSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MasonM.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":"2018-01-05T07:24:33.000Z","updated_at":"2023-09-29T06:26:08.000Z","dependencies_parsed_at":"2023-06-04T20:00:14.108Z","dependency_job_id":null,"html_url":"https://github.com/MasonM/postgres_select_tracker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MasonM/postgres_select_tracker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MasonM%2Fpostgres_select_tracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MasonM%2Fpostgres_select_tracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MasonM%2Fpostgres_select_tracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MasonM%2Fpostgres_select_tracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MasonM","download_url":"https://codeload.github.com/MasonM/postgres_select_tracker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MasonM%2Fpostgres_select_tracker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264504929,"owners_count":23618870,"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","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":["plpgsql","postgresql"],"created_at":"2024-11-15T09:41:42.944Z","updated_at":"2025-07-09T23:04:23.349Z","avatar_url":"https://github.com/MasonM.png","language":"PLpgSQL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# postgres_select_tracker\nPL/pgSQL functions to copy rows that are selected from a given table(s) to a separate tracking table. Meant to help prune unused rows from datasets used for testing, but could also be useful for auditing purposes. Inspired by [this post](https://www.postgresql.org/message-id/CAFcNs+rrRxsO1W5N7UN_p5MJreh7n61gLm1UqAREEm8D534o3Q@mail.gmail.com) by Fabrízio de Royes Mello.\n\nExample:\n\n```sql\n\\i /pgst/pgst_install.sql\n\nCREATE TABLE test(col int);\nINSERT INTO test VALUES (1), (2), (3);\nSELECT pgst_start_for_table('test');\n\nSELECT * FROM test WHERE col \u003c 3;\n-- Will return rows 1 and 2\n\nSELECT * FROM test_pgst_track;\n-- Will also return rows 1 and 2\n```\n\n# Caveats\n1. After calling `pgst_start_for_table(\u003ctable_name\u003e);`, all selects to the table will have an extra column (which can be ignored)\n2. Won't work with tables joined to other tables by an index, because the tracking function will cause PostgreSQL to ignore the index and do a sequential scan.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasonm%2Fpostgres_select_tracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmasonm%2Fpostgres_select_tracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasonm%2Fpostgres_select_tracker/lists"}