diff options
| author | Vadim B. Mikheev | 1997-10-28 15:11:45 +0000 |
|---|---|---|
| committer | Vadim B. Mikheev | 1997-10-28 15:11:45 +0000 |
| commit | 7bff4c50787c52687ad5e23d90c0c5604c57893f (patch) | |
| tree | 54a990c09ce76f0abf1d5b361369312ace44f848 /src/include | |
| parent | 9db2992640245b5cecc3311f5d95504d10a86f21 (diff) | |
Now we are able to CREATE PROCEDURAL LANGUAGE (Thanks, Jan).
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/catalog/pg_language.h | 20 | ||||
| -rw-r--r-- | src/include/commands/proclang.h | 17 | ||||
| -rw-r--r-- | src/include/nodes/nodes.h | 4 | ||||
| -rw-r--r-- | src/include/nodes/parsenodes.h | 143 | ||||
| -rw-r--r-- | src/include/utils/rel.h | 3 | ||||
| -rw-r--r-- | src/include/utils/syscache.h | 3 |
6 files changed, 119 insertions, 71 deletions
diff --git a/src/include/catalog/pg_language.h b/src/include/catalog/pg_language.h index 8c8490b4861..d666688cb40 100644 --- a/src/include/catalog/pg_language.h +++ b/src/include/catalog/pg_language.h @@ -7,7 +7,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: pg_language.h,v 1.4 1997/09/08 02:35:16 momjian Exp $ + * $Id: pg_language.h,v 1.5 1997/10/28 15:08:05 vadim Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -33,6 +33,9 @@ CATALOG(pg_language) { NameData lanname; + bool lanispl; /* Is a procedural language */ + bool lanpltrusted; /* PL is trusted */ + Oid lanplcallfoid; /* Call handler for PL */ text lancompiler; /* VARIABLE LENGTH FIELD */ } FormData_pg_language; @@ -47,21 +50,24 @@ typedef FormData_pg_language *Form_pg_language; * compiler constants for pg_language * ---------------- */ -#define Natts_pg_language 2 +#define Natts_pg_language 5 #define Anum_pg_language_lanname 1 -#define Anum_pg_language_lancompiler 2 +#define Anum_pg_language_lanispl 2 +#define Anum_pg_language_lanpltrusted 3 +#define Anum_pg_language_lanplcallfoid 4 +#define Anum_pg_language_lancompiler 5 /* ---------------- * initial contents of pg_language * ---------------- */ -DATA(insert OID = 11 ( internal "n/a" )); +DATA(insert OID = 11 ( internal f 0 0 "n/a" )); #define INTERNALlanguageId 11 -DATA(insert OID = 12 ( lisp "/usr/ucb/liszt" )); -DATA(insert OID = 13 ( "C" "/bin/cc" )); +DATA(insert OID = 12 ( lisp f 0 0 "/usr/ucb/liszt" )); +DATA(insert OID = 13 ( "C" f 0 0 "/bin/cc" )); #define ClanguageId 13 -DATA(insert OID = 14 ( "sql" "postgres")); +DATA(insert OID = 14 ( "sql" f 0 0 "postgres")); #define SQLlanguageId 14 diff --git a/src/include/commands/proclang.h b/src/include/commands/proclang.h new file mode 100644 index 00000000000..af6182cccab --- /dev/null +++ b/src/include/commands/proclang.h @@ -0,0 +1,17 @@ +/*------------------------------------------------------------------------- + * + * proclang.h-- + * prototypes for proclang.c. + * + * + *------------------------------------------------------------------------- + */ +#ifndef PROCLANG_H +#define PROCLANG_H + +#include <nodes/parsenodes.h> + +extern void CreateProceduralLanguage(CreatePLangStmt * stmt); +extern void DropProceduralLanguage(DropPLangStmt * stmt); + +#endif /* PROCLANG_H */ diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index f60e39d7914..152a1cdd28e 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: nodes.h,v 1.15 1997/09/29 06:01:44 vadim Exp $ + * $Id: nodes.h,v 1.16 1997/10/28 15:10:37 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -185,6 +185,8 @@ typedef enum NodeTag T_VariableResetStmt, T_CreateTrigStmt, T_DropTrigStmt, + T_CreatePLangStmt, + T_DropPLangStmt, T_A_Expr = 700, T_Attr, diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 0bff16711c8..6e9e49b1c01 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: parsenodes.h,v 1.28 1997/09/29 06:01:46 vadim Exp $ + * $Id: parsenodes.h,v 1.29 1997/10/28 15:10:39 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -64,7 +64,7 @@ typedef struct Query List *join_relation_list_; /* list of relations generated by * joins */ bool query_is_archival_; /* archival query flag */ -} Query; +} Query; /***************************************************************************** @@ -98,7 +98,7 @@ typedef struct ChangeACLStmt struct AclItem *aclitem; unsigned modechg; List *relNames; -} ChangeACLStmt; +} ChangeACLStmt; /* ---------------------- * Close Portal Statement @@ -108,7 +108,7 @@ typedef struct ClosePortalStmt { NodeTag type; char *portalname; /* name of the portal (cursor) */ -} ClosePortalStmt; +} ClosePortalStmt; /* ---------------------- * Copy Statement @@ -123,7 +123,7 @@ typedef struct CopyStmt int direction; /* TO or FROM */ char *filename; /* if NULL, use stdin/stdout */ char *delimiter; /* delimiter character, \t by default */ -} CopyStmt; +} CopyStmt; /* ---------------------- * Create Table Statement @@ -145,19 +145,19 @@ typedef struct CreateStmt int location; /* smgrid (-1 if none) */ int archiveLoc; /* smgrid (-1 if none) */ List *constraints; /* list of constraints (ConstaintDef) */ -} CreateStmt; +} CreateStmt; typedef enum ConstrType { CONSTR_NONE, CONSTR_CHECK /* type of constaints */ -} ConstrType; +} ConstrType; typedef struct ConstraintDef { ConstrType type; char *name; /* name */ void *def; /* definition */ -} ConstraintDef; +} ConstraintDef; /* ---------------------- * Create/Drop TRIGGER Statements @@ -178,14 +178,35 @@ typedef struct CreateTrigStmt char *text; /* AS 'text' */ List *attr; /* UPDATE OF a, b,... (NI) or NULL */ char *when; /* WHEN 'a > 10 ...' (NI) or NULL */ -} CreateTrigStmt; +} CreateTrigStmt; typedef struct DropTrigStmt { NodeTag type; char *trigname; /* TRIGGER' name */ char *relname; /* triggered relation */ -} DropTrigStmt; +} DropTrigStmt; + + +/* ---------------------- + * Create/Drop PROCEDURAL LANGUAGE Statement + * ---------------------- + */ +typedef struct CreatePLangStmt +{ + NodeTag type; + char *plname; /* PL name */ + char *plhandler; /* PL call handler function */ + char *plcompiler; /* lancompiler text */ + bool pltrusted; /* PL is trusted */ +} CreatePLangStmt; + +typedef struct DropPLangStmt +{ + NodeTag type; + char *plname; /* PL name */ +} DropPLangStmt; + /* ---------------------- * Create SEQUENCE Statement @@ -197,7 +218,7 @@ typedef struct CreateSeqStmt NodeTag type; char *seqname; /* the relation to create */ List *options; -} CreateSeqStmt; +} CreateSeqStmt; /* ---------------------- * Create Version Statement @@ -210,7 +231,7 @@ typedef struct VersionStmt int direction; /* FORWARD | BACKWARD */ char *fromRelname; /* relation to create a version */ char *date; /* date of the snapshot */ -} VersionStmt; +} VersionStmt; /* ---------------------- * Create {Operator|Type|Aggregate} Statement @@ -222,7 +243,7 @@ typedef struct DefineStmt int defType; /* OPERATOR|P_TYPE|AGGREGATE */ char *defname; List *definition; /* a list of DefElem */ -} DefineStmt; +} DefineStmt; /* ---------------------- * Drop Table Statement @@ -233,7 +254,7 @@ typedef struct DestroyStmt NodeTag type; List *relNames; /* relations to be dropped */ bool sequence; -} DestroyStmt; +} DestroyStmt; /* ---------------------- * Extend Index Statement @@ -246,7 +267,7 @@ typedef struct ExtendStmt Node *whereClause; /* qualifications */ List *rangetable; /* range table, filled in by * transformStmt() */ -} ExtendStmt; +} ExtendStmt; /* ---------------------- * Begin Recipe Statement @@ -256,7 +277,7 @@ typedef struct RecipeStmt { NodeTag type; char *recipeName; /* name of the recipe */ -} RecipeStmt; +} RecipeStmt; /* ---------------------- * Fetch Statement @@ -269,7 +290,7 @@ typedef struct FetchStmt int howMany; /* amount to fetch ("ALL" --> 0) */ char *portalname; /* name of portal (cursor) */ bool ismove; /* TRUE if MOVE */ -} FetchStmt; +} FetchStmt; /* ---------------------- * Create Index Statement @@ -288,7 +309,7 @@ typedef struct IndexStmt * transformStmt() */ bool *lossy; /* is index lossy? */ bool unique; /* is index unique? */ -} IndexStmt; +} IndexStmt; /* ---------------------- * Create Function Statement @@ -305,7 +326,7 @@ typedef struct ProcedureStmt List *withClause; /* a list of ParamString */ char *as; /* the SQL statement or filename */ char *language; /* C or SQL */ -} ProcedureStmt; +} ProcedureStmt; /* ---------------------- * Purge Statement @@ -317,7 +338,7 @@ typedef struct PurgeStmt char *relname; /* relation to purge */ char *beforeDate; /* purge before this date */ char *afterDate; /* purge after this date */ -} PurgeStmt; +} PurgeStmt; /* ---------------------- * Drop Aggregate Statement @@ -328,7 +349,7 @@ typedef struct RemoveAggrStmt NodeTag type; char *aggname; /* aggregate to drop */ char *aggtype; /* for this type */ -} RemoveAggrStmt; +} RemoveAggrStmt; /* ---------------------- * Drop Function Statement @@ -339,7 +360,7 @@ typedef struct RemoveFuncStmt NodeTag type; char *funcname; /* function to drop */ List *args; /* types of the arguments */ -} RemoveFuncStmt; +} RemoveFuncStmt; /* ---------------------- * Drop Operator Statement @@ -350,7 +371,7 @@ typedef struct RemoveOperStmt NodeTag type; char *opname; /* operator to drop */ List *args; /* types of the arguments */ -} RemoveOperStmt; +} RemoveOperStmt; /* ---------------------- * Drop {Type|Index|Rule|View} Statement @@ -361,7 +382,7 @@ typedef struct RemoveStmt NodeTag type; int removeType; /* P_TYPE|INDEX|RULE|VIEW */ char *name; /* name to drop */ -} RemoveStmt; +} RemoveStmt; /* ---------------------- * Alter Table Statement @@ -376,7 +397,7 @@ typedef struct RenameStmt * the new name. Otherwise, rename this * column name. */ char *newname; /* the new name */ -} RenameStmt; +} RenameStmt; /* ---------------------- * Create Rule Statement @@ -391,7 +412,7 @@ typedef struct RuleStmt struct Attr *object; /* object affected */ bool instead; /* is a 'do instead'? */ List *actions; /* the action statements */ -} RuleStmt; +} RuleStmt; /* ---------------------- * Notify Statement @@ -401,7 +422,7 @@ typedef struct NotifyStmt { NodeTag type; char *relname; /* relation to notify */ -} NotifyStmt; +} NotifyStmt; /* ---------------------- * Listen Statement @@ -411,7 +432,7 @@ typedef struct ListenStmt { NodeTag type; char *relname; /* relation to listen on */ -} ListenStmt; +} ListenStmt; /* ---------------------- * {Begin|Abort|End} Transaction Statement @@ -421,7 +442,7 @@ typedef struct TransactionStmt { NodeTag type; int command; /* BEGIN|END|ABORT */ -} TransactionStmt; +} TransactionStmt; /* ---------------------- * Create View Statement @@ -432,7 +453,7 @@ typedef struct ViewStmt NodeTag type; char *viewname; /* name of the view */ Query *query; /* the SQL statement */ -} ViewStmt; +} ViewStmt; /* ---------------------- * Load Statement @@ -442,7 +463,7 @@ typedef struct LoadStmt { NodeTag type; char *filename; /* file to load */ -} LoadStmt; +} LoadStmt; /* ---------------------- * Createdb Statement @@ -452,7 +473,7 @@ typedef struct CreatedbStmt { NodeTag type; char *dbname; /* database to create */ -} CreatedbStmt; +} CreatedbStmt; /* ---------------------- * Destroydb Statement @@ -462,7 +483,7 @@ typedef struct DestroydbStmt { NodeTag type; char *dbname; /* database to drop */ -} DestroydbStmt; +} DestroydbStmt; /* ---------------------- * Cluster Statement (support pbrown's cluster index implementation) @@ -473,7 +494,7 @@ typedef struct ClusterStmt NodeTag type; char *relname; /* relation being indexed */ char *indexname; /* original index defined */ -} ClusterStmt; +} ClusterStmt; /* ---------------------- * Vacuum Statement @@ -486,7 +507,7 @@ typedef struct VacuumStmt bool analyze; /* analyze data */ char *vacrel; /* table to vacuum */ List *va_spec; /* columns to analyse */ -} VacuumStmt; +} VacuumStmt; /* ---------------------- * Explain Statement @@ -497,7 +518,7 @@ typedef struct ExplainStmt NodeTag type; Query *query; /* the query */ bool verbose; /* print plan info */ -} ExplainStmt; +} ExplainStmt; /* ---------------------- * Set Statement @@ -509,7 +530,7 @@ typedef struct VariableSetStmt NodeTag type; char *name; char *value; -} VariableSetStmt; +} VariableSetStmt; /* ---------------------- * Show Statement @@ -520,7 +541,7 @@ typedef struct VariableShowStmt { NodeTag type; char *name; -} VariableShowStmt; +} VariableShowStmt; /* ---------------------- * Reset Statement @@ -531,7 +552,7 @@ typedef struct VariableResetStmt { NodeTag type; char *name; -} VariableResetStmt; +} VariableResetStmt; /***************************************************************************** @@ -561,7 +582,7 @@ typedef struct DeleteStmt NodeTag type; char *relname; /* relation to delete from */ Node *whereClause; /* qualifications */ -} DeleteStmt; +} DeleteStmt; /* ---------------------- * Update Statement @@ -574,7 +595,7 @@ typedef struct ReplaceStmt List *targetList; /* the target list (of ResTarget) */ Node *whereClause; /* qualifications */ List *fromClause; /* the from clause */ -} ReplaceStmt; +} ReplaceStmt; /* ---------------------- * Create Cursor Statement @@ -591,7 +612,7 @@ typedef struct CursorStmt Node *whereClause; /* qualifications */ List *groupClause; /* group by clause */ List *sortClause; /* sort clause (a list of SortGroupBy's) */ -} CursorStmt; +} CursorStmt; /* ---------------------- * Select Statement @@ -609,7 +630,7 @@ typedef struct RetrieveStmt Node *havingClause; /* having conditional-expression */ List *selectClause; /* subselect parameters */ List *sortClause; /* sort clause (a list of SortGroupBy's) */ -} RetrieveStmt; +} RetrieveStmt; /**************************************************************************** @@ -628,7 +649,7 @@ typedef struct SubSelect Node *whereClause; /* qualifications */ List *groupClause; /* group by clause */ Node *havingClause; /* having conditional-expression */ -} SubSelect; +} SubSelect; /* * TypeName - specifies a type in definitions @@ -641,7 +662,7 @@ typedef struct TypeName bool setof; /* is a set? */ List *arrayBounds; /* array bounds */ int typlen; /* length for char() and varchar() */ -} TypeName; +} TypeName; /* * ParamNo - specifies a parameter reference @@ -651,7 +672,7 @@ typedef struct ParamNo NodeTag type; int number; /* the number of the parameter */ TypeName *typename; /* the typecast */ -} ParamNo; +} ParamNo; /* * A_Expr - binary expressions @@ -702,7 +723,7 @@ typedef struct ColumnDef TypeName *typename; /* type of column */ bool is_not_null; /* flag to NOT NULL constraint */ char *defval; /* default value of column */ -} ColumnDef; +} ColumnDef; /* * Ident - @@ -718,7 +739,7 @@ typedef struct Ident List *indirection; /* array references */ bool isRel; /* is a relation - filled in by * transformExpr() */ -} Ident; +} Ident; /* * FuncCall - a function/aggregate invocation @@ -728,7 +749,7 @@ typedef struct FuncCall NodeTag type; char *funcname; /* name of function */ List *args; /* the arguments (list of exprs) */ -} FuncCall; +} FuncCall; /* * A_Indices - array reference or bounds ([lidx:uidx] or [uidx]) @@ -751,7 +772,7 @@ typedef struct ResTarget List *indirection; /* array references */ Node *val; /* the value of the result (A_Expr or * Attr) (or A_Const) */ -} ResTarget; +} ResTarget; /* * ParamString - used in with clauses @@ -761,7 +782,7 @@ typedef struct ParamString NodeTag type; char *name; char *val; -} ParamString; +} ParamString; /* * TimeRange - specifies a time range @@ -771,7 +792,7 @@ typedef struct TimeRange NodeTag type; char *startDate; char *endDate; /* snapshot if NULL */ -} TimeRange; +} TimeRange; /* * RelExpr - relation expressions @@ -782,7 +803,7 @@ typedef struct RelExpr char *relname; /* the relation name */ bool inh; /* inheritance query */ TimeRange *timeRange; /* the time range */ -} RelExpr; +} RelExpr; /* * SortGroupBy - for order by clause @@ -794,7 +815,7 @@ typedef struct SortGroupBy char *range; char *name; /* name of column to sort on */ char *useOp; /* operator to use */ -} SortGroupBy; +} SortGroupBy; /* * RangeVar - range variable, used in from clauses @@ -804,7 +825,7 @@ typedef struct RangeVar NodeTag type; RelExpr *relExpr; /* the relation expression */ char *name; /* the name to be referenced (optional) */ -} RangeVar; +} RangeVar; /* * IndexElem - index parameters (used in create index) @@ -816,7 +837,7 @@ typedef struct IndexElem List *args; /* if not NULL, function index */ char *class; TypeName *tname; /* type of index's keys (optional) */ -} IndexElem; +} IndexElem; /* * DefElem - @@ -827,7 +848,7 @@ typedef struct DefElem NodeTag type; char *defname; Node *arg; /* a (Value *) or a (TypeName *) */ -} DefElem; +} DefElem; /**************************************************************************** @@ -847,7 +868,7 @@ typedef struct TargetEntry Resdom *resdom; /* fjoin overload this to be a list?? */ Fjoin *fjoin; Node *expr; /* can be a list too */ -} TargetEntry; +} TargetEntry; /* * RangeTblEntry - @@ -873,7 +894,7 @@ typedef struct RangeTblEntry bool archive; /* filled in by plan_archive */ bool inFromCl; /* comes from From Clause */ TimeQual timeQual; /* filled in by pg_plan */ -} RangeTblEntry; +} RangeTblEntry; /* * SortClause - @@ -884,7 +905,7 @@ typedef struct SortClause NodeTag type; Resdom *resdom; /* attributes in tlist to be sorted */ Oid opoid; /* sort operators */ -} SortClause; +} SortClause; /* * GroupClause - @@ -895,6 +916,6 @@ typedef struct GroupClause NodeTag type; TargetEntry *entry; /* attributes to group on */ Oid grpOpoid; /* the sort operator to use */ -} GroupClause; +} GroupClause; #endif /* PARSENODES_H */ diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index 0dbf0e1c397..951e12d6f30 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: rel.h,v 1.12 1997/09/08 21:55:16 momjian Exp $ + * $Id: rel.h,v 1.13 1997/10/28 15:11:43 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -25,6 +25,7 @@ typedef struct Trigger char *tgname; Oid tgfoid; func_ptr tgfunc; + func_ptr tgplfunc; int16 tgtype; int16 tgnargs; int16 tgattr[8]; diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h index 54c42a19844..0e37771a67e 100644 --- a/src/include/utils/syscache.h +++ b/src/include/utils/syscache.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: syscache.h,v 1.7 1997/09/08 21:55:17 momjian Exp $ + * $Id: syscache.h,v 1.8 1997/10/28 15:11:45 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -59,6 +59,7 @@ #define REWRITENAME 25 #define PROSRC 26 #define CLADEFTYPE 27 +#define LANOID 28 /* ---------------- * struct cachedesc: information needed for a call to InitSysCache() |
