Append to array on UPDATE

26 views
Skip to first unread message

vamp....@gmail.com

unread,
May 14, 2016, 9:14:17 AM5/14/16
to citus-users
Hi,

I'm trying to append to an array in a distributed table, but I get the following error:
ERROR:  cannot plan sharded modification containing values which are not constants or constant expressions


Query:

CREATE TABLE mytest (
 id uuid,
 myarr integer[],

 PRIMARY KEY (id )
);

SELECT master_create_distributed_table('mytest', 'id', 'hash');
SELECT master_create_worker_shards('mytest', 1, 1);

INSERT INTO mytest VALUES('a4f64b48-2525-4214-8719-f101c5262e27', '{}');

UPDATE mytest
SET myarr = 3 || myarr
WHERE id = 'a4f64b48-2525-4214-8719-f101c5262e27';


Is there any plan to support this?

To avoid race conditions, would the best alternative be to unnest the array into another table?

Brian Cloutier

unread,
May 14, 2016, 10:13:15 AM5/14/16
to vamp....@gmail.com, citus-users

Hello there,

> Is there any plan to support this?

I'm literally working on this now, your UPDATE query will work hopefully in our 5.2 release :)

> To avoid race conditions, would the best alternative be to unnest the array into another table?

Yeah, if unnesting suits your use-case it's likely your easiest alternative. Best is up to you to decide.


14 May 2016 Cmt 16:14 tarihinde <vamp....@gmail.com> şunu yazdı:
--
You received this message because you are subscribed to the Google Groups "citus-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to citus-users...@googlegroups.com.
To post to this group, send email to citus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/citus-users/98b29549-e6bc-4fe8-809f-5f96d5693647%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages