How can use PostgreSQL array_append()
and array_remove()
in Yii? I am trying to update array type attribute on following table rows-
CREATE TABLE Books(
id INT NOT NULL PRIMARY KEY,
name UUID[])
Sample data rows:
1 NULL
2 NULL
$books=Books::model()->findByPk($id);
$books->name='array_append(name, $Name_key_array)';
$books->save();
I have found following error:
CDbException
CDbCommand failed to execute the SQL statement: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: array value must start with "{" or dimension information
But If I use array directly then its work but not when using variable name i.e.
array_append({1,2,3}, {4})
Also, I already tried few more ways but haven't found any success. I hope will find some great ideas to fix this issue.