8000 GitHub - ianstanton/pg_savior
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ianstanton/pg_savior

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pg_savior

pg_savior is a PostgreSQL extension designed to prevent accidental data loss due to non-parameterized DELETE queries without a WHERE clause.

Features

  • Detects DELETE queries without a WHERE clause.
  • Logs detailed information about detected queries.
  • Hooks into the PostgreSQL query execution process.

Installation

  1. Clone the repository.
  2. Navigate to the repository directory.
  3. Run make to build the extension.
  4. Run make install to install the extension.

Demo

$ psql -U visi -d postgres psql
(14.9 (Homebrew))
Type "help" for help.

postgres=#
postgres=# create extension pg_savior;
CREATE EXTENSION

postgres=# select * from emp;
id
----
(0 rows)

postgres=# insert into emp values(1);
INSERT 0 1

postgres=# delete from emp;
INFO: pg_savior: DELETE statement detected
INFO: pg_savior: WHERE clause is mandatory for a DELETE statement
DELETE 0

postgres=# select * from emp;
id
----
 1
(1 row)

demo.png

Usage

After installing the extension, you can enable it in your PostgreSQL database with the following command:

CREATE EXTENSION pg_savior;

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 96.8%
  • Makefile 3.2%
0