Skip to content

wuriyanto48/pgwbase64

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wbase64

Base64 PostgreSQL Extension

Motivation/ Why ?

This is just part of my learning process

Getting started

Building

Clone

$ git clone https://github.com/wuriyanto48/pgwbase64.git

Install PostgreSQL Development server and client

$ sudo apt install libpq-dev
$ sudo apt-get install -y postgresql-server-dev-10

Compile extensions, Create and Copy SHARED Library to /usr/lib/postgresql/10/lib/

$ cc -fPIC -c wbase64.c -I /usr/include/postgresql/10/server/
$ cc -shared -o wbase64.so wbase64.o
$ sudo cp wbase64.so  /usr/lib/postgresql/10/lib/

Notes

To find out what $libdir is referring to, run the following command:

$ pg_config --pkglibdir
/usr/lib/postgresql/10/lib

Install extensions

$ sudo make USE_PGXS=1 install

Install to Database

Login as superuser

$ sudo --login --user postgres
$ psql

Connect to specific Database

$ \c database_name;

Show installed extensions

$ select extname from pg_extension;

Drop extensions

$ DROP EXTENSION IF EXISTS wbase64;

Create extensions

$ CREATE EXTENSION IF NOT EXISTS wbase64;

Test the extensions

Encode

database_name=# select pgw_b64_encode('this is dark') as res;
       res
------------------
 dGhpcyBpcyBkYXJr
(1 row)

Decode

database_name=# select pgw_b64_decode('dGhpcyBpcyBkYXJr') as res;
     res      
--------------
 this is dark
(1 row)

About

Base64 PostgreSQL Extension

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published