plpgsql

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package plpgsql is the hand-written port of libpg_query's PL/pgSQL support as pinned at 18.0.0: pl_gram.y + pl_scanner.c (patched, see internal/reference/), the pl_comp.c / pl_funcs.c subset libpg_query extracts (including its mocks — parse_datatype and friends do not consult the catalogs), pg_query_json_plpgsql.c, and the pg_query_parse_plpgsql.c driver behind ParsePlPgSqlToJSON.

Index

Constants

View Source
const (
	T_WORD plToken = 20000 + iota
	T_CWORD
	T_DATUM
	LESS_LESS
	GREATER_GREATER
	K_ABSOLUTE
	K_ALIAS
	K_ALL
	K_AND
	K_ARRAY
	K_ASSERT
	K_BACKWARD
	K_BEGIN
	K_BY
	K_CALL
	K_CASE
	K_CHAIN
	K_CLOSE
	K_COLLATE
	K_COLUMN
	K_COLUMN_NAME
	K_COMMIT
	K_CONSTANT
	K_CONSTRAINT
	K_CONSTRAINT_NAME
	K_CONTINUE
	K_CURRENT
	K_CURSOR
	K_DATATYPE
	K_DEBUG
	K_DECLARE
	K_DEFAULT
	K_DETAIL
	K_DIAGNOSTICS
	K_DO
	K_DUMP
	K_ELSE
	K_ELSIF
	K_END
	K_ERRCODE
	K_ERROR
	K_EXCEPTION
	K_EXECUTE
	K_EXIT
	K_FETCH
	K_FIRST
	K_FOR
	K_FOREACH
	K_FORWARD
	K_FROM
	K_GET
	K_HINT
	K_IF
	K_IMPORT
	K_IN
	K_INFO
	K_INSERT
	K_INTO
	K_IS
	K_LAST
	K_LOG
	K_LOOP
	K_MERGE
	K_MESSAGE
	K_MESSAGE_TEXT
	K_MOVE
	K_NEXT
	K_NO
	K_NOT
	K_NOTICE
	K_NULL
	K_OPEN
	K_OPTION
	K_OR
	K_PERFORM
	K_PG_CONTEXT
	K_PG_DATATYPE_NAME
	K_PG_EXCEPTION_CONTEXT
	K_PG_EXCEPTION_DETAIL
	K_PG_EXCEPTION_HINT
	K_PG_ROUTINE_OID
	K_PRINT_STRICT_PARAMS
	K_PRIOR
	K_QUERY
	K_RAISE
	K_RELATIVE
	K_RETURN
	K_RETURNED_SQLSTATE
	K_REVERSE
	K_ROLLBACK
	K_ROW_COUNT
	K_ROWTYPE
	K_SCHEMA
	K_SCHEMA_NAME
	K_SCROLL
	K_SLICE
	K_SQLSTATE
	K_STACKED
	K_STRICT
	K_TABLE
	K_TABLE_NAME
	K_THEN
	K_TO
	K_TYPE
	K_USE_COLUMN
	K_USE_VARIABLE
	K_USING
	K_VARIABLE_CONFLICT
	K_WARNING
	K_WHEN
	K_WHILE
)

pl_gram.y token declarations (the PL-specific ones).

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Message   string
	Filename  string
	Funcname  string
	Cursorpos int
	Context   string
}

Error is the public error shape of a PL/pgSQL parse or compile failure.

func ParseToJSON

func ParseToJSON(input string) (string, *Error)

ParseToJSON is pg_query_parse_plpgsql: parse the whole input with the SQL parser, collect CREATE FUNCTION/PROCEDURE and DO statements, compile each with the PL/pgSQL parser, and emit the JSON array of function dumps.

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL