add generic nextval construct

Issue #2085 resolved
Mike Bayer repo owner created an issue

i.e. next_value(some_seq), more usefully apply it to Sequence, some_seq.next_value()

this is somewhat major since we'd be using this construct internally as well for consistency.

Comments (3)

  1. Mike Bayer reporter

    patch attached includes #2084 and #2085 .

    Tests needed:

    • Postgresql executes a Sequence, returns nextval, whether or not "optional" is set
    • Postgresql renders the "nextval" construct, whether or not "optional" is set
    • func.next_value().execute()/.scalar() works
    • Using a DefaultGenerator in the columns, where clause of a select, or in the values clause of insert, update, raises the informative error
    • Same for Sequence, test the additional string
    • can use next_value() in:
    • select column expr
    • whereclause
    • values of insert/update
    • return of next_value is an int, check oracle
    • insert statement:
    • inserted_primary_key contains the result when pk_col=next_value(), when implicit returning is used, when not used, it should be none. probably want to put this in test_returning
    • next_value() used on non-sequence platform either raises NotImplemented, or perhaps we determine some other kind of placeholder
  2. Log in to comment