I have a table named "mkvtable" that establishes a correspondence between individual strings and arrays of strings:
word | mkvword ---------+----------------- hello | {world,friend} goodbye | {home,forever} hi | {fellas,ladies}
According to the documentation provided for PostgreSQL, appending a value to an array of values should be a simple matter of using the concatenation operator: "||".
However, if, I attempt to add the string there
, to the array of strings {fellas,ladies}
which correspond to the word hi
, nothing appears to happen:
SELECT mkvword FROM mkvtable WHERE word = 'hi' || 'there';
PostgresSQL appears to be saying as much:
mkvword
---------
(0 rows)
Since there are no errors thrown, I assume things are syntactically okay.
What am I doing wrong? My best guess is that psql is getting upset that I'm trying to access the array by using it's relationship to a value from the adjacent column, but that's just an uneducated guess. Perhaps this sort of query doesn't jell well with the concatenation operator?
TL;DR: How do you properly concatenate values to arrays stored in table rows?