00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef PLPGSQL_H
00017 #define PLPGSQL_H
00018
00019 #include "postgres.h"
00020
00021 #include "access/xact.h"
00022 #include "commands/event_trigger.h"
00023 #include "commands/trigger.h"
00024 #include "executor/spi.h"
00025
00026
00027
00028
00029
00030
00031 #undef TEXTDOMAIN
00032 #define TEXTDOMAIN PG_TEXTDOMAIN("plpgsql")
00033
00034 #undef _
00035 #define _(x) dgettext(TEXTDOMAIN, x)
00036
00037
00038
00039
00040
00041 enum
00042 {
00043 PLPGSQL_NSTYPE_LABEL,
00044 PLPGSQL_NSTYPE_VAR,
00045 PLPGSQL_NSTYPE_ROW,
00046 PLPGSQL_NSTYPE_REC
00047 };
00048
00049
00050
00051
00052
00053 enum
00054 {
00055 PLPGSQL_DTYPE_VAR,
00056 PLPGSQL_DTYPE_ROW,
00057 PLPGSQL_DTYPE_REC,
00058 PLPGSQL_DTYPE_RECFIELD,
00059 PLPGSQL_DTYPE_ARRAYELEM,
00060 PLPGSQL_DTYPE_EXPR
00061 };
00062
00063
00064
00065
00066
00067 enum
00068 {
00069 PLPGSQL_TTYPE_SCALAR,
00070 PLPGSQL_TTYPE_ROW,
00071 PLPGSQL_TTYPE_REC,
00072 PLPGSQL_TTYPE_PSEUDO
00073 };
00074
00075
00076
00077
00078
00079 enum PLpgSQL_stmt_types
00080 {
00081 PLPGSQL_STMT_BLOCK,
00082 PLPGSQL_STMT_ASSIGN,
00083 PLPGSQL_STMT_IF,
00084 PLPGSQL_STMT_CASE,
00085 PLPGSQL_STMT_LOOP,
00086 PLPGSQL_STMT_WHILE,
00087 PLPGSQL_STMT_FORI,
00088 PLPGSQL_STMT_FORS,
00089 PLPGSQL_STMT_FORC,
00090 PLPGSQL_STMT_FOREACH_A,
00091 PLPGSQL_STMT_EXIT,
00092 PLPGSQL_STMT_RETURN,
00093 PLPGSQL_STMT_RETURN_NEXT,
00094 PLPGSQL_STMT_RETURN_QUERY,
00095 PLPGSQL_STMT_RAISE,
00096 PLPGSQL_STMT_EXECSQL,
00097 PLPGSQL_STMT_DYNEXECUTE,
00098 PLPGSQL_STMT_DYNFORS,
00099 PLPGSQL_STMT_GETDIAG,
00100 PLPGSQL_STMT_OPEN,
00101 PLPGSQL_STMT_FETCH,
00102 PLPGSQL_STMT_CLOSE,
00103 PLPGSQL_STMT_PERFORM
00104 };
00105
00106
00107
00108
00109
00110
00111 enum
00112 {
00113 PLPGSQL_RC_OK,
00114 PLPGSQL_RC_EXIT,
00115 PLPGSQL_RC_RETURN,
00116 PLPGSQL_RC_CONTINUE
00117 };
00118
00119
00120
00121
00122
00123 enum
00124 {
00125 PLPGSQL_GETDIAG_ROW_COUNT,
00126 PLPGSQL_GETDIAG_RESULT_OID,
00127 PLPGSQL_GETDIAG_ERROR_CONTEXT,
00128 PLPGSQL_GETDIAG_ERROR_DETAIL,
00129 PLPGSQL_GETDIAG_ERROR_HINT,
00130 PLPGSQL_GETDIAG_RETURNED_SQLSTATE,
00131 PLPGSQL_GETDIAG_MESSAGE_TEXT
00132 };
00133
00134
00135
00136
00137
00138 enum
00139 {
00140 PLPGSQL_RAISEOPTION_ERRCODE,
00141 PLPGSQL_RAISEOPTION_MESSAGE,
00142 PLPGSQL_RAISEOPTION_DETAIL,
00143 PLPGSQL_RAISEOPTION_HINT
00144 };
00145
00146
00147
00148
00149
00150 typedef enum
00151 {
00152 PLPGSQL_RESOLVE_ERROR,
00153 PLPGSQL_RESOLVE_VARIABLE,
00154 PLPGSQL_RESOLVE_COLUMN
00155 } PLpgSQL_resolve_option;
00156
00157
00158
00159
00160
00161
00162
00163 typedef struct
00164 {
00165 char *typname;
00166 Oid typoid;
00167 int ttype;
00168 int16 typlen;
00169 bool typbyval;
00170 Oid typrelid;
00171 Oid typioparam;
00172 Oid collation;
00173 FmgrInfo typinput;
00174 int32 atttypmod;
00175 } PLpgSQL_type;
00176
00177
00178
00179
00180
00181
00182 typedef struct
00183 {
00184 int dtype;
00185 int dno;
00186 } PLpgSQL_datum;
00187
00188
00189
00190
00191
00192 typedef struct
00193 {
00194 int dtype;
00195 int dno;
00196 char *refname;
00197 int lineno;
00198 } PLpgSQL_variable;
00199
00200 typedef struct PLpgSQL_expr
00201 {
00202 int dtype;
00203 int dno;
00204 char *query;
00205 SPIPlanPtr plan;
00206 Bitmapset *paramnos;
00207
00208
00209 struct PLpgSQL_function *func;
00210
00211
00212 struct PLpgSQL_nsitem *ns;
00213
00214
00215 Expr *expr_simple_expr;
00216 int expr_simple_generation;
00217 Oid expr_simple_type;
00218
00219
00220
00221
00222
00223
00224
00225 ExprState *expr_simple_state;
00226 bool expr_simple_in_use;
00227 LocalTransactionId expr_simple_lxid;
00228 } PLpgSQL_expr;
00229
00230
00231 typedef struct
00232 {
00233 int dtype;
00234 int dno;
00235 char *refname;
00236 int lineno;
00237
00238 PLpgSQL_type *datatype;
00239 int isconst;
00240 int notnull;
00241 PLpgSQL_expr *default_val;
00242 PLpgSQL_expr *cursor_explicit_expr;
00243 int cursor_explicit_argrow;
00244 int cursor_options;
00245
00246 Datum value;
00247 bool isnull;
00248 bool freeval;
00249 } PLpgSQL_var;
00250
00251
00252 typedef struct
00253 {
00254 int dtype;
00255 int dno;
00256 char *refname;
00257 int lineno;
00258
00259 TupleDesc rowtupdesc;
00260
00261
00262
00263
00264
00265
00266
00267
00268 int nfields;
00269 char **fieldnames;
00270 int *varnos;
00271 } PLpgSQL_row;
00272
00273
00274 typedef struct
00275 {
00276 int dtype;
00277 int dno;
00278 char *refname;
00279 int lineno;
00280
00281 HeapTuple tup;
00282 TupleDesc tupdesc;
00283 bool freetup;
00284 bool freetupdesc;
00285 } PLpgSQL_rec;
00286
00287
00288 typedef struct
00289 {
00290 int dtype;
00291 int dno;
00292 char *fieldname;
00293 int recparentno;
00294 } PLpgSQL_recfield;
00295
00296
00297 typedef struct
00298 {
00299 int dtype;
00300 int dno;
00301 PLpgSQL_expr *subscript;
00302 int arrayparentno;
00303
00304 Oid parenttypoid;
00305 int32 parenttypmod;
00306 Oid arraytypoid;
00307 int32 arraytypmod;
00308 int16 arraytyplen;
00309 Oid elemtypoid;
00310 int16 elemtyplen;
00311 bool elemtypbyval;
00312 char elemtypalign;
00313 } PLpgSQL_arrayelem;
00314
00315
00316 typedef struct PLpgSQL_nsitem
00317 {
00318 int itemtype;
00319 int itemno;
00320 struct PLpgSQL_nsitem *prev;
00321 char name[1];
00322 } PLpgSQL_nsitem;
00323
00324
00325 typedef struct
00326 {
00327 int cmd_type;
00328 int lineno;
00329 } PLpgSQL_stmt;
00330
00331
00332 typedef struct PLpgSQL_condition
00333 {
00334 int sqlerrstate;
00335 char *condname;
00336 struct PLpgSQL_condition *next;
00337 } PLpgSQL_condition;
00338
00339 typedef struct
00340 {
00341 int sqlstate_varno;
00342 int sqlerrm_varno;
00343 List *exc_list;
00344 } PLpgSQL_exception_block;
00345
00346 typedef struct
00347 {
00348 int lineno;
00349 PLpgSQL_condition *conditions;
00350 List *action;
00351 } PLpgSQL_exception;
00352
00353
00354 typedef struct
00355 {
00356 int cmd_type;
00357 int lineno;
00358 char *label;
00359 List *body;
00360 int n_initvars;
00361 int *initvarnos;
00362 PLpgSQL_exception_block *exceptions;
00363 } PLpgSQL_stmt_block;
00364
00365
00366 typedef struct
00367 {
00368 int cmd_type;
00369 int lineno;
00370 int varno;
00371 PLpgSQL_expr *expr;
00372 } PLpgSQL_stmt_assign;
00373
00374 typedef struct
00375 {
00376 int cmd_type;
00377 int lineno;
00378 PLpgSQL_expr *expr;
00379 } PLpgSQL_stmt_perform;
00380
00381 typedef struct
00382 {
00383 int kind;
00384 int target;
00385 } PLpgSQL_diag_item;
00386
00387 typedef struct
00388 {
00389 int cmd_type;
00390 int lineno;
00391 bool is_stacked;
00392 List *diag_items;
00393 } PLpgSQL_stmt_getdiag;
00394
00395
00396 typedef struct
00397 {
00398 int cmd_type;
00399 int lineno;
00400 PLpgSQL_expr *cond;
00401 List *then_body;
00402 List *elsif_list;
00403 List *else_body;
00404 } PLpgSQL_stmt_if;
00405
00406 typedef struct
00407 {
00408 int lineno;
00409 PLpgSQL_expr *cond;
00410 List *stmts;
00411 } PLpgSQL_if_elsif;
00412
00413
00414 typedef struct
00415 {
00416 int cmd_type;
00417 int lineno;
00418 PLpgSQL_expr *t_expr;
00419 int t_varno;
00420 List *case_when_list;
00421 bool have_else;
00422 List *else_stmts;
00423 } PLpgSQL_stmt_case;
00424
00425 typedef struct
00426 {
00427 int lineno;
00428 PLpgSQL_expr *expr;
00429 List *stmts;
00430 } PLpgSQL_case_when;
00431
00432
00433 typedef struct
00434 {
00435 int cmd_type;
00436 int lineno;
00437 char *label;
00438 List *body;
00439 } PLpgSQL_stmt_loop;
00440
00441
00442 typedef struct
00443 {
00444 int cmd_type;
00445 int lineno;
00446 char *label;
00447 PLpgSQL_expr *cond;
00448 List *body;
00449 } PLpgSQL_stmt_while;
00450
00451
00452 typedef struct
00453 {
00454 int cmd_type;
00455 int lineno;
00456 char *label;
00457 PLpgSQL_var *var;
00458 PLpgSQL_expr *lower;
00459 PLpgSQL_expr *upper;
00460 PLpgSQL_expr *step;
00461 int reverse;
00462 List *body;
00463 } PLpgSQL_stmt_fori;
00464
00465
00466
00467
00468
00469
00470
00471 typedef struct
00472 {
00473 int cmd_type;
00474 int lineno;
00475 char *label;
00476 PLpgSQL_rec *rec;
00477 PLpgSQL_row *row;
00478 List *body;
00479 } PLpgSQL_stmt_forq;
00480
00481 typedef struct
00482 {
00483 int cmd_type;
00484 int lineno;
00485 char *label;
00486 PLpgSQL_rec *rec;
00487 PLpgSQL_row *row;
00488 List *body;
00489
00490 PLpgSQL_expr *query;
00491 } PLpgSQL_stmt_fors;
00492
00493 typedef struct
00494 {
00495 int cmd_type;
00496 int lineno;
00497 char *label;
00498 PLpgSQL_rec *rec;
00499 PLpgSQL_row *row;
00500 List *body;
00501
00502 int curvar;
00503 PLpgSQL_expr *argquery;
00504 } PLpgSQL_stmt_forc;
00505
00506 typedef struct
00507 {
00508 int cmd_type;
00509 int lineno;
00510 char *label;
00511 PLpgSQL_rec *rec;
00512 PLpgSQL_row *row;
00513 List *body;
00514
00515 PLpgSQL_expr *query;
00516 List *params;
00517 } PLpgSQL_stmt_dynfors;
00518
00519
00520 typedef struct
00521 {
00522 int cmd_type;
00523 int lineno;
00524 char *label;
00525 int varno;
00526 int slice;
00527 PLpgSQL_expr *expr;
00528 List *body;
00529 } PLpgSQL_stmt_foreach_a;
00530
00531
00532 typedef struct
00533 {
00534 int cmd_type;
00535 int lineno;
00536 int curvar;
00537 int cursor_options;
00538 PLpgSQL_row *returntype;
00539 PLpgSQL_expr *argquery;
00540 PLpgSQL_expr *query;
00541 PLpgSQL_expr *dynquery;
00542 List *params;
00543 } PLpgSQL_stmt_open;
00544
00545
00546 typedef struct
00547 {
00548 int cmd_type;
00549 int lineno;
00550 PLpgSQL_rec *rec;
00551 PLpgSQL_row *row;
00552 int curvar;
00553 FetchDirection direction;
00554 long how_many;
00555 PLpgSQL_expr *expr;
00556 bool is_move;
00557 bool returns_multiple_rows;
00558 } PLpgSQL_stmt_fetch;
00559
00560
00561 typedef struct
00562 {
00563 int cmd_type;
00564 int lineno;
00565 int curvar;
00566 } PLpgSQL_stmt_close;
00567
00568
00569 typedef struct
00570 {
00571 int cmd_type;
00572 int lineno;
00573 bool is_exit;
00574 char *label;
00575 PLpgSQL_expr *cond;
00576 } PLpgSQL_stmt_exit;
00577
00578
00579 typedef struct
00580 {
00581 int cmd_type;
00582 int lineno;
00583 PLpgSQL_expr *expr;
00584 int retvarno;
00585 } PLpgSQL_stmt_return;
00586
00587 typedef struct
00588 {
00589 int cmd_type;
00590 int lineno;
00591 PLpgSQL_expr *expr;
00592 int retvarno;
00593 } PLpgSQL_stmt_return_next;
00594
00595 typedef struct
00596 {
00597 int cmd_type;
00598 int lineno;
00599 PLpgSQL_expr *query;
00600 PLpgSQL_expr *dynquery;
00601 List *params;
00602 } PLpgSQL_stmt_return_query;
00603
00604 typedef struct
00605 {
00606 int cmd_type;
00607 int lineno;
00608 int elog_level;
00609 char *condname;
00610 char *message;
00611 List *params;
00612 List *options;
00613 } PLpgSQL_stmt_raise;
00614
00615 typedef struct
00616 {
00617 int opt_type;
00618 PLpgSQL_expr *expr;
00619 } PLpgSQL_raise_option;
00620
00621
00622 typedef struct
00623 {
00624 int cmd_type;
00625 int lineno;
00626 PLpgSQL_expr *sqlstmt;
00627 bool mod_stmt;
00628
00629 bool into;
00630 bool strict;
00631 PLpgSQL_rec *rec;
00632 PLpgSQL_row *row;
00633 } PLpgSQL_stmt_execsql;
00634
00635
00636 typedef struct
00637 {
00638 int cmd_type;
00639 int lineno;
00640 PLpgSQL_expr *query;
00641 bool into;
00642 bool strict;
00643 PLpgSQL_rec *rec;
00644 PLpgSQL_row *row;
00645 List *params;
00646 } PLpgSQL_stmt_dynexecute;
00647
00648
00649 typedef struct PLpgSQL_func_hashkey
00650 {
00651 Oid funcOid;
00652
00653 bool isTrigger;
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663 Oid trigrelOid;
00664
00665
00666
00667
00668
00669
00670 Oid inputCollation;
00671
00672
00673
00674
00675
00676 Oid argtypes[FUNC_MAX_ARGS];
00677 } PLpgSQL_func_hashkey;
00678
00679 typedef enum PLpgSQL_trigtype
00680 {
00681 PLPGSQL_DML_TRIGGER,
00682 PLPGSQL_EVENT_TRIGGER,
00683 PLPGSQL_NOT_TRIGGER
00684 } PLpgSQL_trigtype;
00685
00686 typedef struct PLpgSQL_function
00687 {
00688 char *fn_signature;
00689 Oid fn_oid;
00690 TransactionId fn_xmin;
00691 ItemPointerData fn_tid;
00692 PLpgSQL_trigtype fn_is_trigger;
00693 Oid fn_input_collation;
00694 PLpgSQL_func_hashkey *fn_hashkey;
00695 MemoryContext fn_cxt;
00696
00697 Oid fn_rettype;
00698 int fn_rettyplen;
00699 bool fn_retbyval;
00700 FmgrInfo fn_retinput;
00701 Oid fn_rettypioparam;
00702 bool fn_retistuple;
00703 bool fn_retset;
00704 bool fn_readonly;
00705
00706 int fn_nargs;
00707 int fn_argvarnos[FUNC_MAX_ARGS];
00708 int out_param_varno;
00709 int found_varno;
00710 int new_varno;
00711 int old_varno;
00712 int tg_name_varno;
00713 int tg_when_varno;
00714 int tg_level_varno;
00715 int tg_op_varno;
00716 int tg_relid_varno;
00717 int tg_relname_varno;
00718 int tg_table_name_varno;
00719 int tg_table_schema_varno;
00720 int tg_nargs_varno;
00721 int tg_argv_varno;
00722
00723
00724 int tg_event_varno;
00725 int tg_tag_varno;
00726
00727 PLpgSQL_resolve_option resolve_option;
00728
00729 int ndatums;
00730 PLpgSQL_datum **datums;
00731 PLpgSQL_stmt_block *action;
00732
00733
00734 struct PLpgSQL_execstate *cur_estate;
00735 unsigned long use_count;
00736 } PLpgSQL_function;
00737
00738
00739 typedef struct PLpgSQL_execstate
00740 {
00741 PLpgSQL_function *func;
00742
00743 Datum retval;
00744 bool retisnull;
00745 Oid rettype;
00746
00747 Oid fn_rettype;
00748 bool retistuple;
00749 bool retisset;
00750
00751 bool readonly_func;
00752
00753 TupleDesc rettupdesc;
00754 char *exitlabel;
00755
00756 ErrorData *cur_error;
00757
00758 Tuplestorestate *tuple_store;
00759 MemoryContext tuple_store_cxt;
00760 ResourceOwner tuple_store_owner;
00761 ReturnSetInfo *rsi;
00762
00763 int found_varno;
00764 int ndatums;
00765 PLpgSQL_datum **datums;
00766
00767
00768 SPITupleTable *eval_tuptable;
00769 uint32 eval_processed;
00770 Oid eval_lastoid;
00771 ExprContext *eval_econtext;
00772 PLpgSQL_expr *cur_expr;
00773
00774
00775 PLpgSQL_stmt *err_stmt;
00776 const char *err_text;
00777
00778 void *plugin_info;
00779 } PLpgSQL_execstate;
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813 typedef struct
00814 {
00815
00816 void (*func_setup) (PLpgSQL_execstate *estate, PLpgSQL_function *func);
00817 void (*func_beg) (PLpgSQL_execstate *estate, PLpgSQL_function *func);
00818 void (*func_end) (PLpgSQL_execstate *estate, PLpgSQL_function *func);
00819 void (*stmt_beg) (PLpgSQL_execstate *estate, PLpgSQL_stmt *stmt);
00820 void (*stmt_end) (PLpgSQL_execstate *estate, PLpgSQL_stmt *stmt);
00821
00822
00823 void (*error_callback) (void *arg);
00824 void (*assign_expr) (PLpgSQL_execstate *estate, PLpgSQL_datum *target,
00825 PLpgSQL_expr *expr);
00826 } PLpgSQL_plugin;
00827
00828
00829
00830
00831 typedef struct
00832 {
00833 char *ident;
00834 bool quoted;
00835 } PLword;
00836
00837 typedef struct
00838 {
00839 List *idents;
00840 } PLcword;
00841
00842 typedef struct
00843 {
00844 PLpgSQL_datum *datum;
00845 char *ident;
00846 bool quoted;
00847 List *idents;
00848 } PLwdatum;
00849
00850
00851
00852
00853
00854 typedef enum
00855 {
00856 IDENTIFIER_LOOKUP_NORMAL,
00857 IDENTIFIER_LOOKUP_DECLARE,
00858 IDENTIFIER_LOOKUP_EXPR
00859 } IdentifierLookup;
00860
00861 extern IdentifierLookup plpgsql_IdentifierLookup;
00862
00863 extern int plpgsql_variable_conflict;
00864
00865 extern bool plpgsql_check_syntax;
00866 extern bool plpgsql_DumpExecTree;
00867
00868 extern PLpgSQL_stmt_block *plpgsql_parse_result;
00869
00870 extern int plpgsql_nDatums;
00871 extern PLpgSQL_datum **plpgsql_Datums;
00872
00873 extern char *plpgsql_error_funcname;
00874
00875 extern PLpgSQL_function *plpgsql_curr_compile;
00876 extern MemoryContext compile_tmp_cxt;
00877
00878 extern PLpgSQL_plugin **plugin_ptr;
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888 extern PLpgSQL_function *plpgsql_compile(FunctionCallInfo fcinfo,
00889 bool forValidator);
00890 extern PLpgSQL_function *plpgsql_compile_inline(char *proc_source);
00891 extern void plpgsql_parser_setup(struct ParseState *pstate,
00892 PLpgSQL_expr *expr);
00893 extern bool plpgsql_parse_word(char *word1, const char *yytxt,
00894 PLwdatum *wdatum, PLword *word);
00895 extern bool plpgsql_parse_dblword(char *word1, char *word2,
00896 PLwdatum *wdatum, PLcword *cword);
00897 extern bool plpgsql_parse_tripword(char *word1, char *word2, char *word3,
00898 PLwdatum *wdatum, PLcword *cword);
00899 extern PLpgSQL_type *plpgsql_parse_wordtype(char *ident);
00900 extern PLpgSQL_type *plpgsql_parse_cwordtype(List *idents);
00901 extern PLpgSQL_type *plpgsql_parse_wordrowtype(char *ident);
00902 extern PLpgSQL_type *plpgsql_parse_cwordrowtype(List *idents);
00903 extern PLpgSQL_type *plpgsql_build_datatype(Oid typeOid, int32 typmod,
00904 Oid collation);
00905 extern PLpgSQL_variable *plpgsql_build_variable(const char *refname, int lineno,
00906 PLpgSQL_type *dtype,
00907 bool add2namespace);
00908 extern PLpgSQL_rec *plpgsql_build_record(const char *refname, int lineno,
00909 bool add2namespace);
00910 extern int plpgsql_recognize_err_condition(const char *condname,
00911 bool allow_sqlstate);
00912 extern PLpgSQL_condition *plpgsql_parse_err_condition(char *condname);
00913 extern void plpgsql_adddatum(PLpgSQL_datum *new);
00914 extern int plpgsql_add_initdatums(int **varnos);
00915 extern void plpgsql_HashTableInit(void);
00916
00917
00918
00919
00920
00921 extern void _PG_init(void);
00922 extern Datum plpgsql_call_handler(PG_FUNCTION_ARGS);
00923 extern Datum plpgsql_inline_handler(PG_FUNCTION_ARGS);
00924 extern Datum plpgsql_validator(PG_FUNCTION_ARGS);
00925
00926
00927
00928
00929
00930 extern Datum plpgsql_exec_function(PLpgSQL_function *func,
00931 FunctionCallInfo fcinfo);
00932 extern HeapTuple plpgsql_exec_trigger(PLpgSQL_function *func,
00933 TriggerData *trigdata);
00934 extern void plpgsql_exec_event_trigger(PLpgSQL_function *func,
00935 EventTriggerData *trigdata);
00936 extern void plpgsql_xact_cb(XactEvent event, void *arg);
00937 extern void plpgsql_subxact_cb(SubXactEvent event, SubTransactionId mySubid,
00938 SubTransactionId parentSubid, void *arg);
00939 extern Oid exec_get_datum_type(PLpgSQL_execstate *estate,
00940 PLpgSQL_datum *datum);
00941 extern void exec_get_datum_type_info(PLpgSQL_execstate *estate,
00942 PLpgSQL_datum *datum,
00943 Oid *typeid, int32 *typmod, Oid *collation);
00944
00945
00946
00947
00948
00949 extern void plpgsql_ns_init(void);
00950 extern void plpgsql_ns_push(const char *label);
00951 extern void plpgsql_ns_pop(void);
00952 extern PLpgSQL_nsitem *plpgsql_ns_top(void);
00953 extern void plpgsql_ns_additem(int itemtype, int itemno, const char *name);
00954 extern PLpgSQL_nsitem *plpgsql_ns_lookup(PLpgSQL_nsitem *ns_cur, bool localmode,
00955 const char *name1, const char *name2,
00956 const char *name3, int *names_used);
00957 extern PLpgSQL_nsitem *plpgsql_ns_lookup_label(PLpgSQL_nsitem *ns_cur,
00958 const char *name);
00959
00960
00961
00962
00963
00964 extern const char *plpgsql_stmt_typename(PLpgSQL_stmt *stmt);
00965 extern const char *plpgsql_getdiag_kindname(int kind);
00966 extern void plpgsql_free_function_memory(PLpgSQL_function *func);
00967 extern void plpgsql_dumptree(PLpgSQL_function *func);
00968
00969
00970
00971
00972
00973 extern int plpgsql_base_yylex(void);
00974 extern int plpgsql_yylex(void);
00975 extern void plpgsql_push_back_token(int token);
00976 extern bool plpgsql_token_is_unreserved_keyword(int token);
00977 extern void plpgsql_append_source_text(StringInfo buf,
00978 int startlocation, int endlocation);
00979 extern int plpgsql_peek(void);
00980 extern void plpgsql_peek2(int *tok1_p, int *tok2_p, int *tok1_loc,
00981 int *tok2_loc);
00982 extern int plpgsql_scanner_errposition(int location);
00983 extern void plpgsql_yyerror(const char *message);
00984 extern int plpgsql_location_to_lineno(int location);
00985 extern int plpgsql_latest_lineno(void);
00986 extern void plpgsql_scanner_init(const char *str);
00987 extern void plpgsql_scanner_finish(void);
00988
00989
00990
00991
00992
00993 extern int plpgsql_yyparse(void);
00994
00995 #endif