{"id":14069221,"url":"https://github.com/eradman/pg-safeupdate","last_synced_at":"2025-10-16T22:03:56.818Z","repository":{"id":113362187,"uuid":"126914245","full_name":"eradman/pg-safeupdate","owner":"eradman","description":"A simple extension to PostgreSQL that requires criteria for UPDATE and DELETE","archived":false,"fork":false,"pushed_at":"2024-12-17T00:25:14.000Z","size":32,"stargazers_count":125,"open_issues_count":0,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-25T16:07:45.252Z","etag":null,"topics":["postgresql-extension"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/eradman.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS","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-03-27T02:01:25.000Z","updated_at":"2025-05-20T21:25:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"9580f721-7452-4321-bf38-fba439744feb","html_url":"https://github.com/eradman/pg-safeupdate","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/eradman/pg-safeupdate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eradman%2Fpg-safeupdate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eradman%2Fpg-safeupdate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eradman%2Fpg-safeupdate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eradman%2Fpg-safeupdate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eradman","download_url":"https://codeload.github.com/eradman/pg-safeupdate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eradman%2Fpg-safeupdate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279246399,"owners_count":26133445,"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-16T02:00:06.019Z","response_time":53,"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-extension"],"created_at":"2024-08-13T07:06:43.593Z","updated_at":"2025-10-16T22:03:56.780Z","avatar_url":"https://github.com/eradman.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"Require SQL Where Clause\n========================\n\n`safeupdate` is a simple extension to PostgreSQL that raises an error if\n`UPDATE` and `DELETE` are executed without specifying conditions.  This\nextension was initially designed to protect data from accidental obliteration of\ndata that is writable by [PostgREST].\n\nInstallation\n------------\n\nBuild from source using\n\n    gmake\n    gmake install\n\nActivate per-session by running\n\n    load 'safeupdate';\n\nMake this mandatory for all databases and connections by adding the following to\n`postgresql.conf`:\n\n    shared_preload_libraries=safeupdate\n\nOr enable for a specific database using\n\n    ALTER DATABASE mydb SET session_preload_libraries = 'safeupdate';\n\nOptions\n-------\n\nOnce loaded this extension can be administratively disabled by setting\n\n    SET safeupdate.enabled=0;\n\nExamples\n--------\n\nTry to update records without `WHERE` clause\n\n    UPDATE FROM rack SET fan_speed=70;\n    -- ERROR:  UPDATE requires a WHERE clause\n\nSelect results from a CTE that attempts to modify data:\n\n    WITH updates AS (\n      UPDATE rack SET fan_speed=70\n      RETURNING *\n    )\n    SELECT * FROM updates;\n    -- ERROR:  UPDATE requires a WHERE clause\n\nSet a column value for a range of records\n\n    UPDATE rack SET fan_speed=90 WHERE fan_speed=70;\n\nSet a column value for all the records in a table\n\n    UPDATE rack SET fan_speed=90 WHERE 1=1;\n\nNews\n----\n\nNotification of new releases are provided by an\n[Atom feed](https://github.com/eradman/pg-safeupdate/releases.atom),\nand release history is covered in the [NEWS](NEWS) file.\n\n[PostgREST]: http://postgrest.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feradman%2Fpg-safeupdate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feradman%2Fpg-safeupdate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feradman%2Fpg-safeupdate/lists"}