1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-21 10:42:50 +03:00

Identity columns

This is the SQL standard-conforming variant of PostgreSQL's serial
columns.  It fixes a few usability issues that serial columns have:

- CREATE TABLE / LIKE copies default but refers to same sequence
- cannot add/drop serialness with ALTER TABLE
- dropping default does not drop sequence
- need to grant separate privileges to sequence
- other slight weirdnesses because serial is some kind of special macro

Reviewed-by: Vitaly Burovoy <vitaly.burovoy@gmail.com>
This commit is contained in:
Peter Eisentraut
2017-04-06 08:33:16 -04:00
parent 6bad580d9e
commit 3217327053
57 changed files with 2140 additions and 202 deletions

View File

@@ -1292,6 +1292,20 @@ typedef struct InferenceElem
Oid inferopclass; /* OID of att opclass, or InvalidOid */
} InferenceElem;
/*
* NextValueExpr - get next value from sequence
*
* This has the same effect as calling the nextval() function, but it does not
* check permissions on the sequence. This is used for identity columns,
* where the sequence is an implicit dependency without its own permissions.
*/
typedef struct NextValueExpr
{
Expr xpr;
Oid seqid;
Oid typeId;
} NextValueExpr;
/*--------------------
* TargetEntry -
* a target entry (used in query target lists)