postgresql sequence nextval in schema

前端 未结 2 998
生来不讨喜
生来不讨喜 2020-12-24 10:52

I have a sequence on postgresql 9.3 inside a schema.

I can do this:

SELECT last_value, increment_by from foo."SQ_ID";`


        
相关标签:
2条回答
  • 2020-12-24 11:29
    SELECT last_value, increment_by from "other_schema".id_seq;
    

    for adding a seq to a column where the schema is not public try this.

    nextval('"other_schema".id_seq'::regclass)
    
    0 讨论(0)
  • 2020-12-24 11:47

    The quoting rules are painful. I think you want:

    SELECT nextval('foo."SQ_ID"');
    

    to prevent case-folding of SQ_ID.

    0 讨论(0)
提交回复
热议问题