PostgreSQL SQL
A SQL snippet for PostgreSQL that answers requests for /pixel.gif with the empty GIF, decoded once at startup.
PostgreSQL SQL
CREATE TABLE IF NOT EXISTS assets (
name text PRIMARY KEY,
content_type text NOT NULL,
body bytea NOT NULL
);
INSERT INTO assets (name, content_type, body)
VALUES ('pixel.gif', 'image/gif', decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==', 'base64'))
ON CONFLICT (name) DO UPDATE SET body = EXCLUDED.body;
We ran this snippet and compared the bytes it returned.