bigserial insert error

76 views
Skip to first unread message

armand pirvu

unread,
Aug 12, 2015, 5:09:12 PM8/12/15
to pg_shard users

Hi


" ERROR: cannot plan sharded modification containing values which are not constants or constant expressions"

Is this intended ?

Granted if I use a plain INTEGER and depict the actual value sure thing it works. I am inclined to use autoincrement 

Thanks
-- Armand

Jason Petersen

unread,
Aug 13, 2015, 5:53:43 PM8/13/15
to armand pirvu, pg_shard users
On Aug 12, 2015, at 3:09 PM, armand pirvu <armand...@gmail.com> wrote:

Is this intended ?

Insofar as it’s a side-effect of our initial design decisions, yes :-P

As you probably know, bigserial is actually a shortcut for “this column is a primary key whose default value comes from a sequence”. Sequences are not yet supported, though we have several ideas about how to address this need.

Instagram has a somewhat famous post about dealing with the need for automatic identifiers in a distributed system. It might be worth a look if you’re curious how other engineering groups have solved this problem. One simple solution is to use UUIDs and have the client just generate them upon insert (see also: MongoDB’s ObjectId field).

Granted if I use a plain INTEGER and depict the actual value sure thing it works. I am inclined to use autoincrement 

Yes, using a plain integer with an actual value in the INSERT statement will work.

--
Jason Petersen
Software Engineer | Citus Data

signature.asc

armand pirvu

unread,
Aug 14, 2015, 2:07:57 PM8/14/15
to pg_shard users, armand...@gmail.com
Hi Jason


Thank you for the explanation and references
Just out of curiosity any rough idea when sequences will be supported 

Thanks
Armand

Jason Petersen

unread,
Aug 17, 2015, 3:23:33 PM8/17/15
to armand pirvu, pg_shard users
On Aug 14, 2015, at 11:07 AM, armand pirvu <armand...@gmail.com> wrote:

Just out of curiosity any rough idea when sequences will be supported 

I can’t make any promises as to release scheduling at the moment. We just released pg_shard v1.2, so we’re about to start the cycle for v1.3, and I can confirm that sequences are not in this cycle.

We release quarterly (-ish), so if enough customer demand appears for sequence support it is possible it could be slated for v1.4. But at the moment it isn’t in our list of items for the next release.
signature.asc

armand pirvu

unread,
Aug 17, 2015, 4:18:46 PM8/17/15
to pg_shard users, armand...@gmail.com
Thank you Jason

Armand
Reply all
Reply to author
Forward
0 new messages