]> granicus.if.org Git - postgresql/blob - src/pl/plpgsql/src/plpgsql.h
plpgsql does exceptions.
[postgresql] / src / pl / plpgsql / src / plpgsql.h
1 /**********************************************************************
2  * plpgsql.h            - Definitions for the PL/pgSQL
3  *                        procedural language
4  *
5  * IDENTIFICATION
6  *        $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.48 2004/07/31 07:39:20 tgl Exp $
7  *
8  *        This software is copyrighted by Jan Wieck - Hamburg.
9  *
10  *        The author hereby grants permission  to  use,  copy,  modify,
11  *        distribute,  and      license this software and its documentation
12  *        for any purpose, provided that existing copyright notices are
13  *        retained      in      all  copies  and  that  this notice is included
14  *        verbatim in any distributions. No written agreement, license,
15  *        or  royalty  fee      is required for any of the authorized uses.
16  *        Modifications to this software may be  copyrighted  by  their
17  *        author  and  need  not  follow  the licensing terms described
18  *        here, provided that the new terms are  clearly  indicated  on
19  *        the first page of each file where they apply.
20  *
21  *        IN NO EVENT SHALL THE AUTHOR OR DISTRIBUTORS BE LIABLE TO ANY
22  *        PARTY  FOR  DIRECT,   INDIRECT,       SPECIAL,   INCIDENTAL,   OR
23  *        CONSEQUENTIAL   DAMAGES  ARISING      OUT  OF  THE  USE  OF  THIS
24  *        SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN
25  *        IF  THE  AUTHOR  HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
26  *        DAMAGE.
27  *
28  *        THE  AUTHOR  AND      DISTRIBUTORS  SPECIFICALLY       DISCLAIM       ANY
29  *        WARRANTIES,  INCLUDING,  BUT  NOT  LIMITED  TO,  THE  IMPLIED
30  *        WARRANTIES  OF  MERCHANTABILITY,      FITNESS  FOR  A  PARTICULAR
31  *        PURPOSE,      AND NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON
32  *        AN "AS IS" BASIS, AND THE AUTHOR      AND  DISTRIBUTORS  HAVE  NO
33  *        OBLIGATION   TO       PROVIDE   MAINTENANCE,   SUPPORT,  UPDATES,
34  *        ENHANCEMENTS, OR MODIFICATIONS.
35  *
36  **********************************************************************/
37 #ifndef PLPGSQL_H
38 #define PLPGSQL_H
39
40 #include "postgres.h"
41
42 #include "fmgr.h"
43 #include "miscadmin.h"
44 #include "executor/spi.h"
45 #include "commands/trigger.h"
46 #include "utils/tuplestore.h"
47
48 /**********************************************************************
49  * Definitions
50  **********************************************************************/
51
52 /* ----------
53  * Compilers namestack item types
54  * ----------
55  */
56 enum
57 {
58         PLPGSQL_NSTYPE_LABEL,
59         PLPGSQL_NSTYPE_VAR,
60         PLPGSQL_NSTYPE_ROW,
61         PLPGSQL_NSTYPE_REC
62 };
63
64 /* ----------
65  * Datum array node types
66  * ----------
67  */
68 enum
69 {
70         PLPGSQL_DTYPE_VAR,
71         PLPGSQL_DTYPE_ROW,
72         PLPGSQL_DTYPE_REC,
73         PLPGSQL_DTYPE_RECFIELD,
74         PLPGSQL_DTYPE_ARRAYELEM,
75         PLPGSQL_DTYPE_EXPR,
76         PLPGSQL_DTYPE_TRIGARG
77 };
78
79 /* ----------
80  * Variants distinguished in PLpgSQL_type structs
81  * ----------
82  */
83 enum
84 {
85         PLPGSQL_TTYPE_SCALAR,           /* scalar types and domains */
86         PLPGSQL_TTYPE_ROW,                      /* composite types */
87         PLPGSQL_TTYPE_REC,                      /* RECORD pseudotype */
88         PLPGSQL_TTYPE_PSEUDO            /* other pseudotypes */
89 };
90
91 /* ----------
92  * Execution tree node types
93  * ----------
94  */
95 enum
96 {
97         PLPGSQL_STMT_BLOCK,
98         PLPGSQL_STMT_ASSIGN,
99         PLPGSQL_STMT_IF,
100         PLPGSQL_STMT_LOOP,
101         PLPGSQL_STMT_WHILE,
102         PLPGSQL_STMT_FORI,
103         PLPGSQL_STMT_FORS,
104         PLPGSQL_STMT_SELECT,
105         PLPGSQL_STMT_EXIT,
106         PLPGSQL_STMT_RETURN,
107         PLPGSQL_STMT_RETURN_NEXT,
108         PLPGSQL_STMT_RAISE,
109         PLPGSQL_STMT_EXECSQL,
110         PLPGSQL_STMT_DYNEXECUTE,
111         PLPGSQL_STMT_DYNFORS,
112         PLPGSQL_STMT_GETDIAG,
113         PLPGSQL_STMT_OPEN,
114         PLPGSQL_STMT_FETCH,
115         PLPGSQL_STMT_CLOSE,
116         PLPGSQL_STMT_PERFORM
117 };
118
119
120 /* ----------
121  * Execution node return codes
122  * ----------
123  */
124 enum
125 {
126         PLPGSQL_RC_OK,
127         PLPGSQL_RC_EXIT,
128         PLPGSQL_RC_RETURN
129 };
130
131 /* ----------
132  * GET DIAGNOSTICS system attrs
133  * ----------
134  */
135 enum
136 {
137         PLPGSQL_GETDIAG_ROW_COUNT,
138         PLPGSQL_GETDIAG_RESULT_OID
139 };
140
141
142 /**********************************************************************
143  * Node and structure definitions
144  **********************************************************************/
145
146
147 typedef struct
148 {                                                               /* Dynamic string control structure */
149         int                     alloc;
150         int                     used;
151         char       *value;
152 }       PLpgSQL_dstring;
153
154
155 typedef struct
156 {                                                               /* Postgres data type */
157         char       *typname;            /* (simple) name of the type */
158         Oid                     typoid;                 /* OID of the data type */
159         int                     ttype;                  /* PLPGSQL_TTYPE_ code */
160         int16           typlen;                 /* stuff copied from its pg_type entry */
161         bool            typbyval;
162         Oid                     typrelid;
163         Oid                     typioparam;
164         FmgrInfo        typinput;               /* lookup info for typinput function */
165         int32           atttypmod;              /* typmod (taken from someplace else) */
166 }       PLpgSQL_type;
167
168
169 /*
170  * PLpgSQL_datum is the common supertype for PLpgSQL_expr, PLpgSQL_var,
171  * PLpgSQL_row, PLpgSQL_rec, PLpgSQL_recfield, PLpgSQL_arrayelem, and
172  * PLpgSQL_trigarg
173  */
174 typedef struct
175 {                                                               /* Generic datum array item             */
176         int                     dtype;
177         int                     dno;
178 }       PLpgSQL_datum;
179
180 /*
181  * The variants PLpgSQL_var, PLpgSQL_row, and PLpgSQL_rec share these
182  * fields
183  */
184 typedef struct
185 {                                                               /* Scalar or composite variable */
186         int                     dtype;
187         int                     dno;
188         char       *refname;
189         int                     lineno;
190 }       PLpgSQL_variable;
191
192 typedef struct PLpgSQL_expr
193 {                                                               /* SQL Query to plan and execute        */
194         int                     dtype;
195         int                     exprno;
196         char       *query;
197         void       *plan;
198         Oid                *plan_argtypes;
199         /* fields for "simple expression" fast-path execution: */
200         Expr       *expr_simple_expr;   /* NULL means not a simple expr */
201         Oid                     expr_simple_type;
202         /* if expr is simple AND in use in current xact, these fields are set: */
203         ExprState  *expr_simple_state;
204         struct PLpgSQL_expr *expr_simple_next;
205         /* params to pass to expr */
206         int                     nparams;
207         int                     params[1];              /* VARIABLE SIZE ARRAY ... must be last */
208 }       PLpgSQL_expr;
209
210
211 typedef struct
212 {                                                               /* Scalar variable */
213         int                     dtype;
214         int                     varno;
215         char       *refname;
216         int                     lineno;
217
218         PLpgSQL_type *datatype;
219         int                     isconst;
220         int                     notnull;
221         PLpgSQL_expr *default_val;
222         PLpgSQL_expr *cursor_explicit_expr;
223         int                     cursor_explicit_argrow;
224
225         Datum           value;
226         bool            isnull;
227         bool            freeval;
228 }       PLpgSQL_var;
229
230
231 typedef struct
232 {                                                               /* Row variable */
233         int                     dtype;
234         int                     rowno;
235         char       *refname;
236         int                     lineno;
237
238         TupleDesc       rowtupdesc;
239
240         /*
241          * Note: TupleDesc is only set up for named rowtypes, else it is NULL.
242          *
243          * Note: if the underlying rowtype contains a dropped column, the
244          * corresponding fieldnames[] entry will be NULL, and there is no
245          * corresponding var (varnos[] will be -1).
246          */
247         int                     nfields;
248         char      **fieldnames;
249         int                *varnos;
250 }       PLpgSQL_row;
251
252
253 typedef struct
254 {                                                               /* Record variable (non-fixed structure) */
255         int                     dtype;
256         int                     recno;
257         char       *refname;
258         int                     lineno;
259
260         HeapTuple       tup;
261         TupleDesc       tupdesc;
262         bool            freetup;
263         bool            freetupdesc;
264 }       PLpgSQL_rec;
265
266
267 typedef struct
268 {                                                               /* Field in record */
269         int                     dtype;
270         int                     rfno;
271         char       *fieldname;
272         int                     recparentno;    /* dno of parent record */
273 }       PLpgSQL_recfield;
274
275
276 typedef struct
277 {                                                               /* Element of array variable */
278         int                     dtype;
279         int                     dno;
280         PLpgSQL_expr *subscript;
281         int                     arrayparentno;  /* dno of parent array variable */
282 }       PLpgSQL_arrayelem;
283
284
285 typedef struct
286 {                                                               /* Positional argument to trigger       */
287         int                     dtype;
288         int                     dno;
289         PLpgSQL_expr *argnum;
290 }       PLpgSQL_trigarg;
291
292
293 typedef struct
294 {                                                               /* Item in the compilers namestack      */
295         int                     itemtype;
296         int                     itemno;
297         char            name[1];
298 }       PLpgSQL_nsitem;
299
300
301 typedef struct PLpgSQL_ns
302 {                                                               /* Compiler namestack level             */
303         int                     items_alloc;
304         int                     items_used;
305         PLpgSQL_nsitem **items;
306         struct PLpgSQL_ns *upper;
307 }       PLpgSQL_ns;
308
309
310 typedef struct
311 {                                                               /* Generic execution node               */
312         int                     cmd_type;
313         int                     lineno;
314 }       PLpgSQL_stmt;
315
316
317 typedef struct
318 {                                                               /* List of execution nodes              */
319         int                     stmts_alloc;    /* XXX this oughta just be a List ... */
320         int                     stmts_used;
321         PLpgSQL_stmt **stmts;
322 }       PLpgSQL_stmts;
323
324
325 typedef struct
326 {                                                               /* One EXCEPTION ... WHEN clause */
327         int                     lineno;
328         char       *label;
329         PLpgSQL_stmts *action;
330 }       PLpgSQL_exception;
331
332
333 typedef struct
334 {                                                               /* List of WHEN clauses                 */
335         int                     exceptions_alloc;       /* XXX this oughta just be a List ... */
336         int                     exceptions_used;
337         PLpgSQL_exception **exceptions;
338 }       PLpgSQL_exceptions;
339
340
341 typedef struct
342 {                                                               /* Block of statements                  */
343         int                     cmd_type;
344         int                     lineno;
345         char       *label;
346         PLpgSQL_stmts *body;
347         PLpgSQL_exceptions *exceptions;
348         int                     n_initvars;
349         int                *initvarnos;
350 }       PLpgSQL_stmt_block;
351
352
353 typedef struct
354 {                                                               /* Assign statement                     */
355         int                     cmd_type;
356         int                     lineno;
357         int                     varno;
358         PLpgSQL_expr *expr;
359 }       PLpgSQL_stmt_assign;
360
361 typedef struct
362 {                                                               /* PERFORM statement            */
363         int                     cmd_type;
364         int                     lineno;
365         PLpgSQL_expr *expr;
366 }       PLpgSQL_stmt_perform;
367
368 typedef struct
369 {                                                               /* Get Diagnostics item         */
370         int                     item;                   /* id for diagnostic value desired */
371         int                     target;                 /* where to assign it */
372 }       PLpgSQL_diag_item;
373
374 typedef struct
375 {                                                               /* Get Diagnostics statement            */
376         int                     cmd_type;
377         int                     lineno;
378         int                     ndtitems;
379         PLpgSQL_diag_item *dtitems;
380 }       PLpgSQL_stmt_getdiag;
381
382
383 typedef struct
384 {                                                               /* IF statement                         */
385         int                     cmd_type;
386         int                     lineno;
387         PLpgSQL_expr *cond;
388         PLpgSQL_stmts *true_body;
389         PLpgSQL_stmts *false_body;
390 }       PLpgSQL_stmt_if;
391
392
393 typedef struct
394 {                                                               /* Unconditional LOOP statement         */
395         int                     cmd_type;
396         int                     lineno;
397         char       *label;
398         PLpgSQL_stmts *body;
399 }       PLpgSQL_stmt_loop;
400
401
402 typedef struct
403 {                                                               /* WHILE cond LOOP statement            */
404         int                     cmd_type;
405         int                     lineno;
406         char       *label;
407         PLpgSQL_expr *cond;
408         PLpgSQL_stmts *body;
409 }       PLpgSQL_stmt_while;
410
411
412 typedef struct
413 {                                                               /* FOR statement with integer loopvar   */
414         int                     cmd_type;
415         int                     lineno;
416         char       *label;
417         PLpgSQL_var *var;
418         PLpgSQL_expr *lower;
419         PLpgSQL_expr *upper;
420         int                     reverse;
421         PLpgSQL_stmts *body;
422 }       PLpgSQL_stmt_fori;
423
424
425 typedef struct
426 {                                                               /* FOR statement running over SELECT    */
427         int                     cmd_type;
428         int                     lineno;
429         char       *label;
430         PLpgSQL_rec *rec;
431         PLpgSQL_row *row;
432         PLpgSQL_expr *query;
433         PLpgSQL_stmts *body;
434 }       PLpgSQL_stmt_fors;
435
436
437 typedef struct
438 {                                                               /* FOR statement running over EXECUTE   */
439         int                     cmd_type;
440         int                     lineno;
441         char       *label;
442         PLpgSQL_rec *rec;
443         PLpgSQL_row *row;
444         PLpgSQL_expr *query;
445         PLpgSQL_stmts *body;
446 }       PLpgSQL_stmt_dynfors;
447
448
449 typedef struct
450 {                                                               /* SELECT ... INTO statement            */
451         int                     cmd_type;
452         int                     lineno;
453         PLpgSQL_rec *rec;
454         PLpgSQL_row *row;
455         PLpgSQL_expr *query;
456 }       PLpgSQL_stmt_select;
457
458
459 typedef struct
460 {                                                               /* OPEN a curvar                                        */
461         int                     cmd_type;
462         int                     lineno;
463         int                     curvar;
464         PLpgSQL_row *returntype;
465         PLpgSQL_expr *argquery;
466         PLpgSQL_expr *query;
467         PLpgSQL_expr *dynquery;
468 }       PLpgSQL_stmt_open;
469
470
471 typedef struct
472 {                                                               /* FETCH curvar INTO statement          */
473         int                     cmd_type;
474         int                     lineno;
475         PLpgSQL_rec *rec;
476         PLpgSQL_row *row;
477         int                     curvar;
478 }       PLpgSQL_stmt_fetch;
479
480
481 typedef struct
482 {                                                               /* CLOSE curvar                                         */
483         int                     cmd_type;
484         int                     lineno;
485         int                     curvar;
486 }       PLpgSQL_stmt_close;
487
488
489 typedef struct
490 {                                                               /* EXIT statement                       */
491         int                     cmd_type;
492         int                     lineno;
493         char       *label;
494         PLpgSQL_expr *cond;
495 }       PLpgSQL_stmt_exit;
496
497
498 typedef struct
499 {                                                               /* RETURN statement                     */
500         int                     cmd_type;
501         int                     lineno;
502         PLpgSQL_expr *expr;
503         int                     retrecno;
504         int                     retrowno;
505 }       PLpgSQL_stmt_return;
506
507 typedef struct
508 {                                                               /* RETURN NEXT statement */
509         int                     cmd_type;
510         int                     lineno;
511         PLpgSQL_rec *rec;
512         PLpgSQL_row *row;
513         PLpgSQL_expr *expr;
514 }       PLpgSQL_stmt_return_next;
515
516 typedef struct
517 {                                                               /* RAISE statement                      */
518         int                     cmd_type;
519         int                     lineno;
520         int                     elog_level;
521         char       *message;
522         int                     nparams;
523         int                *params;
524 }       PLpgSQL_stmt_raise;
525
526
527 typedef struct
528 {                                                               /* Generic SQL statement to execute */
529         int                     cmd_type;
530         int                     lineno;
531         PLpgSQL_expr *sqlstmt;
532 }       PLpgSQL_stmt_execsql;
533
534
535 typedef struct
536 {                                                               /* Dynamic SQL string to execute */
537         int                     cmd_type;
538         int                     lineno;
539         PLpgSQL_expr *query;
540 }       PLpgSQL_stmt_dynexecute;
541
542
543 typedef struct PLpgSQL_func_hashkey
544 {                                                               /* Hash lookup key for functions */
545         Oid                     funcOid;
546
547         /*
548          * For a trigger function, the OID of the relation triggered on is part
549          * of the hashkey --- we want to compile the trigger separately for each
550          * relation it is used with, in case the rowtype is different.  Zero if
551          * not called as a trigger.
552          */
553         Oid                     trigrelOid;
554
555         /*
556          * We include actual argument types in the hash key to support
557          * polymorphic PLpgSQL functions.  Be careful that extra positions are
558          * zeroed!
559          */
560         Oid                     argtypes[FUNC_MAX_ARGS];
561 }       PLpgSQL_func_hashkey;
562
563
564 typedef struct PLpgSQL_function
565 {                                                               /* Complete compiled function     */
566         char       *fn_name;
567         Oid                     fn_oid;
568         TransactionId fn_xmin;
569         CommandId       fn_cmin;
570         int                     fn_functype;
571         PLpgSQL_func_hashkey *fn_hashkey;       /* back-link to hashtable key */
572
573         Oid                     fn_rettype;
574         int                     fn_rettyplen;
575         bool            fn_retbyval;
576         FmgrInfo        fn_retinput;
577         Oid                     fn_rettypioparam;
578         bool            fn_retistuple;
579         bool            fn_retset;
580
581         int                     fn_nargs;
582         int                     fn_argvarnos[FUNC_MAX_ARGS];
583         int                     found_varno;
584         int                     new_varno;
585         int                     old_varno;
586         int                     tg_name_varno;
587         int                     tg_when_varno;
588         int                     tg_level_varno;
589         int                     tg_op_varno;
590         int                     tg_relid_varno;
591         int                     tg_relname_varno;
592         int                     tg_nargs_varno;
593
594         int                     ndatums;
595         PLpgSQL_datum **datums;
596         PLpgSQL_stmt_block *action;
597 }       PLpgSQL_function;
598
599
600 typedef struct
601 {                                                               /* Runtime execution data       */
602         Datum           retval;
603         bool            retisnull;
604         Oid                     rettype;                /* type of current retval */
605
606         Oid                     fn_rettype;             /* info about declared function rettype */
607         bool            retistuple;
608         bool            retisset;
609
610         TupleDesc       rettupdesc;
611         char       *exitlabel;
612
613         Tuplestorestate *tuple_store;           /* SRFs accumulate results here */
614         MemoryContext tuple_store_cxt;
615         ReturnSetInfo *rsi;
616
617         int                     trig_nargs;
618         Datum      *trig_argv;
619
620         int                     found_varno;
621         int                     ndatums;
622         PLpgSQL_datum **datums;
623
624         /* temporary state for results from evaluation of query or expr */
625         SPITupleTable *eval_tuptable;
626         uint32          eval_processed;
627         Oid                     eval_lastoid;
628         ExprContext *eval_econtext;
629
630         /* status information for error context reporting */
631         PLpgSQL_function *err_func; /* current func */
632         PLpgSQL_stmt *err_stmt;         /* current stmt */
633         const char *err_text;           /* additional state info */
634 }       PLpgSQL_execstate;
635
636
637 /**********************************************************************
638  * Global variable declarations
639  **********************************************************************/
640
641 extern int      plpgsql_DumpExecTree;
642 extern int      plpgsql_SpaceScanned;
643 extern int      plpgsql_nDatums;
644 extern PLpgSQL_datum **plpgsql_Datums;
645
646 extern int      plpgsql_error_lineno;
647 extern char *plpgsql_error_funcname;
648
649 /* linkage to the real yytext variable */
650 extern char *plpgsql_base_yytext;
651
652 #define plpgsql_yytext plpgsql_base_yytext
653
654 extern PLpgSQL_function *plpgsql_curr_compile;
655
656 /**********************************************************************
657  * Function declarations
658  **********************************************************************/
659
660 /* ----------
661  * Functions in pl_comp.c
662  * ----------
663  */
664 extern PLpgSQL_function *plpgsql_compile(FunctionCallInfo fcinfo,
665                                                                                  bool forValidator);
666 extern int      plpgsql_parse_word(char *word);
667 extern int      plpgsql_parse_dblword(char *word);
668 extern int      plpgsql_parse_tripword(char *word);
669 extern int      plpgsql_parse_wordtype(char *word);
670 extern int      plpgsql_parse_dblwordtype(char *word);
671 extern int      plpgsql_parse_tripwordtype(char *word);
672 extern int      plpgsql_parse_wordrowtype(char *word);
673 extern int      plpgsql_parse_dblwordrowtype(char *word);
674 extern PLpgSQL_type *plpgsql_parse_datatype(const char *string);
675 extern PLpgSQL_type *plpgsql_build_datatype(Oid typeOid, int32 typmod);
676 extern PLpgSQL_variable *plpgsql_build_variable(char *refname, int lineno,
677                                                                                                 PLpgSQL_type *dtype,
678                                                                                                 bool add2namespace);
679 extern void plpgsql_adddatum(PLpgSQL_datum *new);
680 extern int      plpgsql_add_initdatums(int **varnos);
681 extern void plpgsql_HashTableInit(void);
682
683 /* ----------
684  * Functions in pl_handler.c
685  * ----------
686  */
687 extern void plpgsql_init(void);
688 extern Datum plpgsql_call_handler(PG_FUNCTION_ARGS);
689 extern Datum plpgsql_validator(PG_FUNCTION_ARGS);
690
691 /* ----------
692  * Functions in pl_exec.c
693  * ----------
694  */
695 extern Datum plpgsql_exec_function(PLpgSQL_function * func,
696                                           FunctionCallInfo fcinfo);
697 extern HeapTuple plpgsql_exec_trigger(PLpgSQL_function * func,
698                                          TriggerData *trigdata);
699 extern void plpgsql_eoxact(bool isCommit, void *arg);
700
701 /* ----------
702  * Functions for the dynamic string handling in pl_funcs.c
703  * ----------
704  */
705 extern void plpgsql_dstring_init(PLpgSQL_dstring * ds);
706 extern void plpgsql_dstring_free(PLpgSQL_dstring * ds);
707 extern void plpgsql_dstring_append(PLpgSQL_dstring * ds, char *str);
708 extern char *plpgsql_dstring_get(PLpgSQL_dstring * ds);
709
710 /* ----------
711  * Functions for the namestack handling in pl_funcs.c
712  * ----------
713  */
714 extern void plpgsql_ns_init(void);
715 extern bool plpgsql_ns_setlocal(bool flag);
716 extern void plpgsql_ns_push(char *label);
717 extern void plpgsql_ns_pop(void);
718 extern void plpgsql_ns_additem(int itemtype, int itemno, char *name);
719 extern PLpgSQL_nsitem *plpgsql_ns_lookup(char *name, char *nsname);
720 extern void plpgsql_ns_rename(char *oldname, char *newname);
721
722 /* ----------
723  * Other functions in pl_funcs.c
724  * ----------
725  */
726 extern void plpgsql_convert_ident(const char *s, char **output, int numidents);
727 extern const char *plpgsql_stmt_typename(PLpgSQL_stmt * stmt);
728 extern void plpgsql_dumptree(PLpgSQL_function * func);
729
730 /* ----------
731  * Externs in gram.y and scan.l
732  * ----------
733  */
734 extern PLpgSQL_expr *plpgsql_read_expression(int until, const char *expected);
735 extern int      plpgsql_yyparse(void);
736 extern int      plpgsql_base_yylex(void);
737 extern int      plpgsql_yylex(void);
738 extern void plpgsql_push_back_token(int token);
739 extern void plpgsql_yyerror(const char *message);
740 extern int      plpgsql_scanner_lineno(void);
741 extern void plpgsql_scanner_init(const char *str, int functype);
742 extern void plpgsql_scanner_finish(void);
743 extern char *plpgsql_get_string_value(void);
744
745 #endif   /* PLPGSQL_H */