SwordOfSouls
SwordOfSouls

Reputation: 63

Representing Composite Types under ''

I'm currently using Neon to use Postgres from a serverless origin and have been needing to find a way to use ARRAY and ROW under ''s with no success.

Example

UPDATE communication.messages
SET message_content = row ('test', ARRAY [
    row (
        'test','test','0',
        ARRAY [
            row ('test','2','true')
        ] :: message_embed_field[])
    ]::message_embed[],
    ARRAY []::message_attachment[],ARRAY []::message_button[], 'true')
WHERE id = 'dd998de9-2da9-4fda-9530-fbe90c078f18'
RETURNING *;

Have tried the following

UPDATE communication.messages
SET message_content = '(''test'',''{"(''test'',''test'',''0'',''{"(''test'',''2'',''true'')"}'')"}'',''{}'',''{}'',''true'')'
WHERE id = 'dd998de9-2da9-4fda-9530-fbe90c078f18'
RETURNING *;

but have not been able to solve the following

[2024-03-03 22:40:07] [22P02] ERROR: malformed array literal: "'{}'"
[2024-03-03 22:40:07] Detail: Array value must start with "{" or dimension information.
[2024-03-03 22:40:07] Position: 54

Any assistance would be greatly appreciated

Upvotes: 0

Views: 47

Answers (0)

Related Questions