← Back to team overview

maria-developers team mailing list archive

Re: CREATE SEQUENCE is coming

 


On 28/03/17 07:31, Vladislav Vaintroub wrote:
> 
> 
> On 3/27/2017 6:15 AM, Daniel Black wrote:
>> On 26/03/17 22:11, Michael Widenius wrote:
>>> There is still a lot of work to fix edge cases, but in the current
>>> implementation most major things seams to work...
>>>
>>> Comments, suggestions or questions?
>> NICE!
>>
>> How will this value be exposed to getGeneratedKeys in
>> mariadb-connector-j?
> I do not think it needs to. Statement.getGeneratedKeys returns generated
> auto-increment values on insert, the same ulonglong that is in OK
> packet, the same thing that LAST_INSERT_ID() is returning.
>  no sequences involved

Ah, ok. I was miss understanding how Postgres does its sequences. I
found this quick summary from 2011 (date in http response header)
http://www.neilconway.org/docs/sequences/

Oracle ref:
http://docs.oracle.com/cd/B28359_01/server.111/b28286/pseudocolumns002.htm#SQLRF51138
uses sequence.CURRVAL, sequence.NEXTVAL

https://www.postgresql.org/docs/9.6/static/functions-sequence.html

As a note itseams PREVIOUS VALUE FOR seems to be a DB2 construct.
Postgres uses CURRVAL(sequence) which to me sounds more sound. I guess
MDEV-10422 INSERT RETURNING is the alternative.

All options work. Thanks for writing this.

So it seems they show up as full table where querying them is pretty
harmless? I suspect if things like pt-table-sync start trying to modify
them ugly things could happen.



References