https://github.com/wuriyanto48/pgwbase64
Base64 PostgreSQL Extension
https://github.com/wuriyanto48/pgwbase64
c postgresql-extension
Last synced: 2 days ago
JSON representation
Base64 PostgreSQL Extension
- Host: GitHub
- URL: https://github.com/wuriyanto48/pgwbase64
- Owner: wuriyanto48
- License: mit
- Created: 2022-08-20T08:37:20.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-12-21T18:36:42.000Z (over 3 years ago)
- Last Synced: 2025-10-26T08:49:43.121Z (9 months ago)
- Topics: c, postgresql-extension
- Language: C
- Homepage:
- Size: 18.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wbase64
Base64 PostgreSQL Extension
## Motivation/ Why ?
This is just part of my learning process
## Getting started
### Building
Clone
```shell
$ git clone https://github.com/wuriyanto48/pgwbase64.git
```
Install PostgreSQL Development server and client
```shell
$ 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/`
```shell
$ 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:
```shell
$ pg_config --pkglibdir
/usr/lib/postgresql/10/lib
```
Install extensions
```shell
$ sudo make USE_PGXS=1 install
```
### Install to Database
Login as superuser
```shell
$ sudo --login --user postgres
$ psql
```
Connect to specific Database
```shell
$ \c database_name;
```
Show installed extensions
```shell
$ select extname from pg_extension;
```
Drop extensions
```shell
$ DROP EXTENSION IF EXISTS wbase64;
```
Create extensions
```shell
$ CREATE EXTENSION IF NOT EXISTS wbase64;
```
### Test the extensions
Encode
```shell
database_name=# select pgw_b64_encode('this is dark') as res;
res
------------------
dGhpcyBpcyBkYXJr
(1 row)
```
Decode
```shell
database_name=# select pgw_b64_decode('dGhpcyBpcyBkYXJr') as res;
res
--------------
this is dark
(1 row)
```