Skip to content
/ pg_poop Public

A Postgres extension that rewrites strings to 💩

License

Notifications You must be signed in to change notification settings

skyzh/pg_poop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pg_poop

This Postgres extension will rewrite all VARCHAR/TEXT columns with poop emojis. Only tested with pg15.

The extension was originally created as a demo plugin of pgextmgrext, which is an extension manager (as an extension) that extends Postgres hooks to make it easier to develop Postgres extensions. The version using pgext can be found here.

Install

git clone https://github.com/skyzh/pg_poop && cd pg_poop
make PG_CONFIG={PATH TO pg_config} USE_PGXS=1 install

Usage

pgextmgr=# select '1';
 ?column?
----------
 1
(1 row)

pgextmgr=# LOAD 'pg_poop';
LOAD
pgextmgr=# select '1';
 ?column?
----------
 💩
(1 row)

How does it work?

pg_poop will use the ExecutorRun hook in Postgres and replace the output destination with pg_poop's custom destination pipe. In the pipe, it will find all varchar/text columns, get the size of the datum, and replace it with poop emojis of the same length.

One alternative way to do pg_poop is to hook the planner and wrap all varchar/text output column with a function that replaces all chars with emoji, which is how it worked in PostgreSQL Anonymizer extension.

About

A Postgres extension that rewrites strings to 💩

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published