wnpet
wnpet

Reputation: 1

how to format array param in pgsql?

I pass a string from c as"{1,2,3,4,5}",and try use it to update array int[] record in a table as format("UPDATE table SET array = %s WHERE *** ",string)

but get the error

"lastError = 0x009f0bda "ERROR:  column "houses_list" is of type integer[] but expression is of type text"

please give a correct format of update array use string in pgsql,tks

Upvotes: 0

Views: 93

Answers (1)

Michael Krelin - hacker
Michael Krelin - hacker

Reputation: 143229

You can try '{1,2,3,4,5}'::int[] or ARRAY[1,2,3,4,5].

Upvotes: 2

Related Questions