psycopg2:如何用行更新多维数组

psycopg2: how to update multidimensional array with row

我正在努力用新行更新我的 postgres table 中的多维数组。在 psql 中:

CREATE TABLE list_of_arrays (my_array int[]);
INSERT INTO list_of_arrays VALUES ('{{1, 2}}');
UPDATE list_of_arrays SET my_array = my_array || '{{3, 4}}';
SELECT * FROM list_of_arrays;

生成数组:

{{1,2},{3,4}} 

在 psycopg2 中,但是更新步骤失败:

row1 = [[1, 2]]
row2 = [[3, 4]]
cur.execute("INSERT INTO list_of_arrays VALUES (%s);", (row1,))
cur.execute("UPDATE TABLE list_of_arrays SET my_array = my_array || %s;",(row2,))

returns:

psycopg2.ProgrammingError: syntax error at or near "TABLE" LINE 1:
UPDATE TABLE list_of_arrays SET my_array = my_array || ARRAY

我觉得应该是这样的:

cur.execute("UPDATE list_of_arrays SET my_array = my_array || %s;",(row2,))

没有关键字TABLE