postgresql/src/include/nodes/makefuncs.h
Tom Lane 2b2a50722c Fix all known problems with pg_dump's handling of serial sequences
by abandoning the idea that it should say SERIAL in the dump.  Instead,
dump serial sequences and column defaults just like regular ones.
Add a new backend command ALTER SEQUENCE OWNED BY to let pg_dump recreate
the sequence-to-column dependency that was formerly created "behind the
scenes" by SERIAL.  This restores SERIAL to being truly "just a macro"
consisting of component operations that can be stated explicitly in SQL.
Furthermore, the new command allows sequence ownership to be reassigned,
so that old mistakes can be cleaned up.

Also, downgrade the OWNED-BY dependency from INTERNAL to AUTO, since there
is no longer any very compelling argument why the sequence couldn't be
dropped while keeping the column.  (This forces initdb, to be sure the
right kinds of dependencies are in there.)

Along the way, add checks to prevent ALTER OWNER or SET SCHEMA on an
owned sequence; you can now only do this indirectly by changing the
owning table's owner or schema.  This is an oversight in previous
releases, but probably not worth back-patching.
2006-08-21 00:57:26 +00:00

68 lines
1.9 KiB
C

/*-------------------------------------------------------------------------
*
* makefuncs.h
* prototypes for the creator functions (for primitive nodes)
*
*
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/nodes/makefuncs.h,v 1.56 2006/08/21 00:57:26 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef MAKEFUNC_H
#define MAKEFUNC_H
#include "nodes/parsenodes.h"
extern A_Expr *makeA_Expr(A_Expr_Kind kind, List *name,
Node *lexpr, Node *rexpr, int location);
extern A_Expr *makeSimpleA_Expr(A_Expr_Kind kind, const char *name,
Node *lexpr, Node *rexpr, int location);
extern Var *makeVar(Index varno,
AttrNumber varattno,
Oid vartype,
int32 vartypmod,
Index varlevelsup);
extern TargetEntry *makeTargetEntry(Expr *expr,
AttrNumber resno,
char *resname,
bool resjunk);
extern TargetEntry *flatCopyTargetEntry(TargetEntry *src_tle);
extern Const *makeConst(Oid consttype,
int constlen,
Datum constvalue,
bool constisnull,
bool constbyval);
extern Const *makeNullConst(Oid consttype);
extern Node *makeBoolConst(bool value, bool isnull);
extern Expr *makeBoolExpr(BoolExprType boolop, List *args);
extern Alias *makeAlias(const char *aliasname, List *colnames);
extern RelabelType *makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod,
CoercionForm rformat);
extern RangeVar *makeRangeVar(char *schemaname, char *relname);
extern TypeName *makeTypeName(char *typnam);
extern TypeName *makeTypeNameFromNameList(List *names);
extern TypeName *makeTypeNameFromOid(Oid typeid, int32 typmod);
extern FuncExpr *makeFuncExpr(Oid funcid, Oid rettype,
List *args, CoercionForm fformat);
extern DefElem *makeDefElem(char *name, Node *arg);
#endif /* MAKEFUNC_H */