Readit News logoReadit News
frectonz commented on Show HN: Embed an SQLite database in your PostgreSQL table   github.com/frectonz/pglit... · Posted by u/frectonz
ellisv · 10 months ago
But can I have one row that holds all the databases?
frectonz · 10 months ago
yes you can

CREATE TABLE crime_against_humanity ( databases SQLITE[] );

frectonz commented on Show HN: Embed an SQLite database in your PostgreSQL table   github.com/frectonz/pglit... · Posted by u/frectonz
arkh · 10 months ago
You may want to use the $$ way to declare strings for your examples. Something like:

-- Create a todo for "frectonz"

UPDATE people

SET database = execute_sqlite(

    database,

    $sqlite$INSERT INTO todos VALUES ('solve multitenancy')$sqlite$
)

WHERE name = 'frectonz';

frectonz · 10 months ago
oh nice, i didn't know this existed, thanks
frectonz commented on Show HN: Embed an SQLite database in your PostgreSQL table   github.com/frectonz/pglit... · Posted by u/frectonz
Apreche · 10 months ago
That’s fun, but I think I'll just use an SQLite foreign data wrapper instead.
frectonz · 10 months ago
That's the sensible option but not the fun one.
frectonz commented on Show HN: Embed an SQLite database in your PostgreSQL table   github.com/frectonz/pglit... · Posted by u/frectonz
michelpp · 10 months ago
I think the right approach would be to store the sqlite database as a varlena type that can be TOASTed and then "expanded" using the Expanded Datum API so that it's a live open database connection for the life of the transaction:

https://www.postgresql.org/docs/17/xtypes.html#XTYPES-TOAST

https://github.com/postgres/postgres/blob/master/src/include...

frectonz · 10 months ago
Thanks i will look into this more, /tmp stuff is most definitely a hack.
frectonz commented on Show HN: Embed an SQLite database in your PostgreSQL table   github.com/frectonz/pglit... · Posted by u/frectonz
aerzen · 10 months ago
Ok, hear me out: what if we make something that takes a postgres database dir, tars it together and encodes it as a binary blob in SQLite?

We could have SQLite within postgres within sqlite within postgres! Is it practical or even slightly useful? Of course not - but it's SQL databases all the way down. Not that this is a good thing in itself.

frectonz · 10 months ago
My next project
frectonz commented on Show HN: If YouTube had actual channels   ytch.xyz... · Posted by u/hadisafa
frectonz · a year ago
Somebody finally made the Interdimensional Cable from Rick and Morty.

u/frectonz

KarmaCake day98November 22, 2022View Original