Replies: 1 comment 2 replies
-
|
Heyo! been using wal2json to spin up my own real-time database and I'm loving it so far. I was wondering if there was support for array types? I'm pipelining wal2json to a kafka broker and I noticed that an empty array appears to be returned as a string Looking into the returned Table: CREATE TABLE IF NOT EXISTS messages (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
user_id UUID NOT NULL,
chat_id UUID NOT NULL,
message_timestamp TIMESTAMP NOT NULL,
users_read UUID[] NOT NULL,
message_text VARCHAR NOT NULL,
FOREIGN KEY (user_id) REFERENCES xuser(id),
FOREIGN KEY (user_id,chat_id) REFERENCES user_chats(user_id,chat_id)
);Example insert statement: WITH result AS (INSERT INTO messages (user_id, chat_id, message_timestamp, users_read, message_text)
VALUES ($1, $2, NOW(), '{}', $3) RETURNING chat_id, id)
UPDATE chats SET last_message=result.id FROM result WHERE chats.id=result.chat_id;Extract of JSON output (for an insert): I didn't want to open an issue as I couldn't tell if I could just pass in a parameter to enable the datatype or not! |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
👋 Welcome!
We’re using Discussions as a place to connect with other members of our community. We hope that you:
build together 💪.
Beta Was this translation helpful? Give feedback.
All reactions