Skip to content

Wrong pg array value parsing, expecting array, got string #32

@RapidCodeLab

Description

@RapidCodeLab

schema.yml
...... - {name: categories, type: array, is_nullable: false} ......

somewhere in functions
local tuples = pg_connect:execute('SELECT ARRAY[1,2,3] AS categories') json.encode(tuples)

result
[ [ { "categories": "{1,2,3}" } ] ]

in right way should be like this

json.encode({categories = {1,2,3})

result
{ "categories": [ 1, 2, 3 ] }

some string from test file
t:q('SELECT ARRAY[1,2] AS arr, 1.2 AS pos', {{ arr = '{1,2}', pos = 1.2}})

so in general, when i try insert pg array type value parsed by this connecor to type: array filed, i got error.

InsertError: Failed to insert: Tuple field 14 (content_categories) type does not match one required by operation: expected array, got string

in parse_pg_value function do not realised parsing for pg array. so by default it parse it as string...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions