Documentation
¶
Index ¶
- Constants
- Variables
- type AggExpr
- type AnalyzedExpr
- type ArrayExprQ
- type BoolExprQ
- type BoolOpType
- type BoolTestType
- type BooleanTestExpr
- type BuiltinCast
- type BuiltinOperator
- type BuiltinProc
- type BuiltinType
- type CaseExprQ
- type CaseWhenQ
- type Catalog
- func (c *Catalog) AlterDomainStmt(stmt *nodes.AlterDomainStmt) error
- func (c *Catalog) AlterEnumStmt(stmt *nodes.AlterEnumStmt) error
- func (c *Catalog) AlterFunction(stmt *nodes.AlterFunctionStmt) error
- func (c *Catalog) AlterPolicy(stmt *nodes.AlterPolicyStmt) error
- func (c *Catalog) AlterSequenceStmt(stmt *nodes.AlterSeqStmt) error
- func (c *Catalog) AlterTableStmt(stmt *nodes.AlterTableStmt) error
- func (c *Catalog) CanCoerce(source, target uint32, context byte) bool
- func (c *Catalog) Clone() *Catalog
- func (c *Catalog) CommentObject(stmt *nodes.CommentStmt) error
- func (c *Catalog) ConstraintsOf(relOID uint32) []*Constraint
- func (c *Catalog) CreateCast(stmt *nodes.CreateCastStmt) error
- func (c *Catalog) CreateFunctionStmt(stmt *nodes.CreateFunctionStmt) error
- func (c *Catalog) CreatePolicy(stmt *nodes.CreatePolicyStmt) error
- func (c *Catalog) CreateSchemaCommand(stmt *nodes.CreateSchemaStmt) error
- func (c *Catalog) CreateTriggerStmt(stmt *nodes.CreateTrigStmt) error
- func (c *Catalog) DefineAggregate(stmt *nodes.DefineStmt) error
- func (c *Catalog) DefineCompositeType(stmt *nodes.CompositeTypeStmt) error
- func (c *Catalog) DefineDomain(stmt *nodes.CreateDomainStmt) error
- func (c *Catalog) DefineEnum(stmt *nodes.CreateEnumStmt) error
- func (c *Catalog) DefineIndex(stmt *nodes.IndexStmt) error
- func (c *Catalog) DefineOperator(stmt *nodes.DefineStmt) error
- func (c *Catalog) DefineRange(stmt *nodes.CreateRangeStmt) error
- func (c *Catalog) DefineRelation(stmt *nodes.CreateStmt, relkind byte) error
- func (c *Catalog) DefineSequence(stmt *nodes.CreateSeqStmt) error
- func (c *Catalog) DefineType(stmt *nodes.DefineStmt) error
- func (c *Catalog) DefineView(stmt *nodes.ViewStmt) error
- func (c *Catalog) DomainInfo(typeOID uint32) *DomainType
- func (c *Catalog) DrainWarnings() []Warning
- func (c *Catalog) EnumValues(typeOID uint32) []string
- func (c *Catalog) Exec(sql string, opts *ExecOptions) ([]ExecResult, error)
- func (c *Catalog) ExecAlterObjectSchemaStmt(stmt *nodes.AlterObjectSchemaStmt) error
- func (c *Catalog) ExecCreateTableAs(stmt *nodes.CreateTableAsStmt) error
- func (c *Catalog) ExecGrantStmt(stmt *nodes.GrantStmt) error
- func (c *Catalog) ExecRefreshMatView(stmt *nodes.RefreshMatViewStmt) error
- func (c *Catalog) ExecRenameStmt(stmt *nodes.RenameStmt) error
- func (c *Catalog) ExecuteTruncate(stmt *nodes.TruncateStmt) error
- func (c *Catalog) FindCoercionPathway(source, target uint32, context byte) (CoercionPathway, uint32)
- func (c *Catalog) FormatType(typeOID uint32, typmod int32) string
- func (c *Catalog) GetComment(objType byte, objOID uint32, subID int16) (string, bool)
- func (c *Catalog) GetIndexByOID(oid uint32) *Index
- func (c *Catalog) GetRelation(schema, name string) *Relation
- func (c *Catalog) GetRelationByOID(oid uint32) *Relation
- func (c *Catalog) GetSchema(name string) *Schema
- func (c *Catalog) GetViewDefinition(schema, name string) (string, error)
- func (c *Catalog) IndexesOf(relOID uint32) []*Index
- func (c *Catalog) IsBinaryCoercible(source, target uint32) bool
- func (c *Catalog) LookupCast(source, target uint32) *BuiltinCast
- func (c *Catalog) LookupOperatorExact(name string, left, right uint32) []*BuiltinOperator
- func (c *Catalog) LookupProcByName(name string) []*BuiltinProc
- func (c *Catalog) LookupProcByOID(oid uint32) *BuiltinProc
- func (c *Catalog) ProcessUtility(stmt nodes.Node) error
- func (c *Catalog) QueryPgAttrdef(relOID uint32) []PgAttrdefRow
- func (c *Catalog) QueryPgAttribute(relOID uint32) []PgAttributeRow
- func (c *Catalog) QueryPgClass(schemaName string) []PgClassRow
- func (c *Catalog) QueryPgConstraint(relOID uint32) []PgConstraintRow
- func (c *Catalog) QueryPgDepend() []PgDependRow
- func (c *Catalog) QueryPgDescription() []PgDescriptionRow
- func (c *Catalog) QueryPgEnum(typeOID uint32) []PgEnumRow
- func (c *Catalog) QueryPgIndex(relOID uint32) []PgIndexRow
- func (c *Catalog) QueryPgInherits() []PgInheritsRow
- func (c *Catalog) QueryPgNamespace() []PgNamespaceRow
- func (c *Catalog) QueryPgPolicy(relOID uint32) []PgPolicyRow
- func (c *Catalog) QueryPgProc(schemaName string) []PgProcRow
- func (c *Catalog) QueryPgSequence(schemaName string) []PgSequenceRow
- func (c *Catalog) QueryPgTrigger(relOID uint32) []PgTriggerRow
- func (c *Catalog) QueryPgType(schemaName string) []PgTypeRow
- func (c *Catalog) RangeInfo(typeOID uint32) *RangeType
- func (c *Catalog) RemoveObjects(stmt *nodes.DropStmt) error
- func (c *Catalog) RemoveRelations(stmt *nodes.DropStmt) error
- func (c *Catalog) RemoveSchemas(stmt *nodes.DropStmt) error
- func (c *Catalog) ResolveType(tn TypeName) (oid uint32, typmod int32, err error)
- func (c *Catalog) SelectCommonType(typeOIDs []uint32) (uint32, error)
- func (c *Catalog) SequencesOf(schemaName string) []*Sequence
- func (c *Catalog) SetSearchPath(schemas []string)
- func (c *Catalog) TriggersOf(relOID uint32) []*Trigger
- func (c *Catalog) TypeByOID(oid uint32) *BuiltinType
- func (c *Catalog) UserSchemas() []*Schema
- type CoalesceExprQ
- type CoerceViaIOExpr
- type CoercionPathway
- type CollateExprQ
- type Column
- type ColumnDef
- type CommonTableExprQ
- type ConstExpr
- type Constraint
- type ConstraintDef
- type ConstraintType
- type DepEntry
- type DepType
- type DistinctExprQ
- type DomainConstraint
- type DomainType
- type EnumType
- type EnumValue
- type Error
- type ExecOptions
- type ExecResult
- type FieldSelectExprQ
- type FuncCallExpr
- type Grant
- type GroupingSetKind
- type GroupingSetQ
- type Index
- type InhEntry
- type JoinExprNode
- type JoinNode
- type JoinTree
- type JoinType
- type MinMaxExprQ
- type MinMaxOp
- type NullIfExprQ
- type NullTestExpr
- type OIDGenerator
- type OpExpr
- type PartitionBound
- type PartitionInfo
- type PgAttrdefRow
- type PgAttributeRow
- type PgClassRow
- type PgConstraintRow
- type PgDependRow
- type PgDescriptionRow
- type PgEnumRow
- type PgIndexRow
- type PgInheritsRow
- type PgNamespaceRow
- type PgPolicyRow
- type PgProcRow
- type PgSequenceRow
- type PgTriggerRow
- type PgTypeRow
- type Policy
- type Query
- type RTEKind
- type RangeTableEntry
- type RangeTableRef
- type RangeType
- type RelabelExpr
- type Relation
- type ResultColumn
- type RowExprQ
- type SQLValueFuncExpr
- type SVFOp
- type ScalarArrayOpExpr
- type Schema
- type Sequence
- type SetOpType
- type SortGroupClause
- type SubLinkExpr
- type SubLinkType
- type TargetEntry
- type Trigger
- type TriggerEvent
- type TriggerTiming
- type TypeName
- type UserProc
- type VarExpr
- type Warning
- type WindowClauseQ
- type WindowFuncExpr
Constants ¶
const ( CodeWarning = "01000" // generic warning CodeWarningSkip = "00000" // IF NOT EXISTS / IF EXISTS skipped )
SQLSTATE warning codes matching PostgreSQL.
const ( CodeDuplicateSchema = "42P06" CodeDuplicateTable = "42P07" CodeDuplicateColumn = "42701" CodeDuplicateObject = "42710" CodeUndefinedSchema = "3F000" CodeUndefinedTable = "42P01" CodeUndefinedColumn = "42703" CodeUndefinedObject = "42704" CodeSchemaNotEmpty = "2BP01" CodeDependentObjects = "2BP01" CodeWrongObjectType = "42809" CodeInvalidParameterValue = "22023" CodeInvalidFK = "42830" CodeInvalidTableDefinition = "42P16" CodeDuplicatePKey = "42P16" // same SQLSTATE as InvalidTableDefinition CodeDatatypeMismatch = "42804" CodeUndefinedFunction = "42883" CodeAmbiguousColumn = "42702" CodeAmbiguousFunction = "42725" CodeInvalidColumnDefinition = "42611" CodeTooManyColumns = "54011" CodeFeatureNotSupported = "0A000" CodeDuplicateFunction = "42723" CodeInvalidObjectDefinition = "42P17" CodeSyntaxError = "42601" CodeInvalidFunctionDefinition = "42P13" CodeCheckViolation = "23514" CodeNotNullViolation = "23502" CodeForeignKeyViolation = "23503" CodeUniqueViolation = "23505" CodeIndeterminateCollation = "42P22" CodeObjectNotInPrerequisiteState = "55000" CodeInvalidGrantOperation = "0LP01" CodeProgramLimitExceeded = "54000" CodeReservedName = "42939" )
SQLSTATE error codes matching PostgreSQL.
const ( InvalidOid uint32 = 0 PGCatalogNamespace uint32 = 11 PGToastNamespace uint32 = 99 PublicNamespace uint32 = 2200 FirstNormalObjectId uint32 = 16384 )
Well-known namespace OIDs matching PostgreSQL.
const ( BOOLOID uint32 = 16 BYTEAOID uint32 = 17 CHAROID uint32 = 18 NAMEOID uint32 = 19 INT8OID uint32 = 20 INT2OID uint32 = 21 INT2VECTOROID uint32 = 22 INT4OID uint32 = 23 REGPROCOID uint32 = 24 TEXTOID uint32 = 25 OIDOID uint32 = 26 TIDOID uint32 = 27 XIDOID uint32 = 28 CIDOID uint32 = 29 OIDVECTOROID uint32 = 30 PGDDLCOMMANDOID uint32 = 32 PGTYPEOID uint32 = 71 PGATTRIBUTEOID uint32 = 75 PGPROCOID uint32 = 81 PGCLASSOID uint32 = 83 JSONOID uint32 = 114 XMLOID uint32 = 142 XMLARRAYOID uint32 = 143 PGNODETREEOID uint32 = 194 JSONARRAYOID uint32 = 199 PGTYPEARRAYOID uint32 = 210 TABLEAMHANDLEROID uint32 = 269 PGATTRIBUTEARRAYOID uint32 = 270 XID8ARRAYOID uint32 = 271 PGPROCARRAYOID uint32 = 272 PGCLASSARRAYOID uint32 = 273 INDEXAMHANDLEROID uint32 = 325 POINTOID uint32 = 600 LSEGOID uint32 = 601 PATHOID uint32 = 602 BOXOID uint32 = 603 POLYGONOID uint32 = 604 LINEOID uint32 = 628 LINEARRAYOID uint32 = 629 CIDROID uint32 = 650 CIDRARRAYOID uint32 = 651 FLOAT4OID uint32 = 700 FLOAT8OID uint32 = 701 UNKNOWNOID uint32 = 705 CIRCLEOID uint32 = 718 CIRCLEARRAYOID uint32 = 719 MACADDR8OID uint32 = 774 MACADDR8ARRAYOID uint32 = 775 MONEYOID uint32 = 790 MONEYARRAYOID uint32 = 791 MACADDROID uint32 = 829 INETOID uint32 = 869 BOOLARRAYOID uint32 = 1000 BYTEAARRAYOID uint32 = 1001 CHARARRAYOID uint32 = 1002 NAMEARRAYOID uint32 = 1003 INT2ARRAYOID uint32 = 1005 INT2VECTORARRAYOID uint32 = 1006 INT4ARRAYOID uint32 = 1007 REGPROCARRAYOID uint32 = 1008 TEXTARRAYOID uint32 = 1009 TIDARRAYOID uint32 = 1010 XIDARRAYOID uint32 = 1011 CIDARRAYOID uint32 = 1012 OIDVECTORARRAYOID uint32 = 1013 BPCHARARRAYOID uint32 = 1014 VARCHARARRAYOID uint32 = 1015 INT8ARRAYOID uint32 = 1016 POINTARRAYOID uint32 = 1017 LSEGARRAYOID uint32 = 1018 PATHARRAYOID uint32 = 1019 BOXARRAYOID uint32 = 1020 FLOAT4ARRAYOID uint32 = 1021 FLOAT8ARRAYOID uint32 = 1022 POLYGONARRAYOID uint32 = 1027 OIDARRAYOID uint32 = 1028 ACLITEMOID uint32 = 1033 ACLITEMARRAYOID uint32 = 1034 MACADDRARRAYOID uint32 = 1040 INETARRAYOID uint32 = 1041 BPCHAROID uint32 = 1042 VARCHAROID uint32 = 1043 DATEOID uint32 = 1082 TIMEOID uint32 = 1083 TIMESTAMPOID uint32 = 1114 TIMESTAMPARRAYOID uint32 = 1115 DATEARRAYOID uint32 = 1182 TIMEARRAYOID uint32 = 1183 TIMESTAMPTZOID uint32 = 1184 TIMESTAMPTZARRAYOID uint32 = 1185 INTERVALOID uint32 = 1186 INTERVALARRAYOID uint32 = 1187 NUMERICARRAYOID uint32 = 1231 CSTRINGARRAYOID uint32 = 1263 TIMETZOID uint32 = 1266 TIMETZARRAYOID uint32 = 1270 BITOID uint32 = 1560 BITARRAYOID uint32 = 1561 VARBITOID uint32 = 1562 VARBITARRAYOID uint32 = 1563 NUMERICOID uint32 = 1700 REFCURSOROID uint32 = 1790 REFCURSORARRAYOID uint32 = 2201 REGPROCEDUREOID uint32 = 2202 REGOPEROID uint32 = 2203 REGOPERATOROID uint32 = 2204 REGCLASSOID uint32 = 2205 REGTYPEOID uint32 = 2206 REGPROCEDUREARRAYOID uint32 = 2207 REGOPERARRAYOID uint32 = 2208 REGOPERATORARRAYOID uint32 = 2209 REGCLASSARRAYOID uint32 = 2210 REGTYPEARRAYOID uint32 = 2211 RECORDOID uint32 = 2249 CSTRINGOID uint32 = 2275 ANYOID uint32 = 2276 ANYARRAYOID uint32 = 2277 VOIDOID uint32 = 2278 TRIGGEROID uint32 = 2279 LANGUAGEHANDLEROID uint32 = 2280 INTERNALOID uint32 = 2281 ANYELEMENTOID uint32 = 2283 RECORDARRAYOID uint32 = 2287 ANYNONARRAYOID uint32 = 2776 TXIDSNAPSHOTARRAYOID uint32 = 2949 UUIDOID uint32 = 2950 UUIDARRAYOID uint32 = 2951 TXIDSNAPSHOTOID uint32 = 2970 FDWHANDLEROID uint32 = 3115 PGLSNOID uint32 = 3220 PGLSNARRAYOID uint32 = 3221 TSMHANDLEROID uint32 = 3310 PGNDISTINCTOID uint32 = 3361 PGDEPENDENCIESOID uint32 = 3402 ANYENUMOID uint32 = 3500 TSVECTOROID uint32 = 3614 TSQUERYOID uint32 = 3615 GTSVECTOROID uint32 = 3642 TSVECTORARRAYOID uint32 = 3643 GTSVECTORARRAYOID uint32 = 3644 TSQUERYARRAYOID uint32 = 3645 REGCONFIGOID uint32 = 3734 REGCONFIGARRAYOID uint32 = 3735 REGDICTIONARYOID uint32 = 3769 REGDICTIONARYARRAYOID uint32 = 3770 JSONBOID uint32 = 3802 JSONBARRAYOID uint32 = 3807 ANYRANGEOID uint32 = 3831 EVENTTRIGGEROID uint32 = 3838 INT4RANGEOID uint32 = 3904 INT4RANGEARRAYOID uint32 = 3905 NUMRANGEOID uint32 = 3906 NUMRANGEARRAYOID uint32 = 3907 TSRANGEOID uint32 = 3908 TSRANGEARRAYOID uint32 = 3909 TSTZRANGEOID uint32 = 3910 TSTZRANGEARRAYOID uint32 = 3911 DATERANGEOID uint32 = 3912 DATERANGEARRAYOID uint32 = 3913 INT8RANGEOID uint32 = 3926 INT8RANGEARRAYOID uint32 = 3927 JSONPATHOID uint32 = 4072 JSONPATHARRAYOID uint32 = 4073 REGNAMESPACEOID uint32 = 4089 REGNAMESPACEARRAYOID uint32 = 4090 REGROLEOID uint32 = 4096 REGROLEARRAYOID uint32 = 4097 REGCOLLATIONOID uint32 = 4191 REGCOLLATIONARRAYOID uint32 = 4192 INT4MULTIRANGEOID uint32 = 4451 NUMMULTIRANGEOID uint32 = 4532 TSMULTIRANGEOID uint32 = 4533 TSTZMULTIRANGEOID uint32 = 4534 DATEMULTIRANGEOID uint32 = 4535 INT8MULTIRANGEOID uint32 = 4536 ANYMULTIRANGEOID uint32 = 4537 ANYCOMPATIBLEMULTIRANGEOID uint32 = 4538 PGBRINBLOOMSUMMARYOID uint32 = 4600 PGBRINMINMAXMULTISUMMARYOID uint32 = 4601 PGMCVLISTOID uint32 = 5017 PGSNAPSHOTOID uint32 = 5038 PGSNAPSHOTARRAYOID uint32 = 5039 XID8OID uint32 = 5069 ANYCOMPATIBLEOID uint32 = 5077 ANYCOMPATIBLEARRAYOID uint32 = 5078 ANYCOMPATIBLENONARRAYOID uint32 = 5079 ANYCOMPATIBLERANGEOID uint32 = 5080 INT4MULTIRANGEARRAYOID uint32 = 6150 NUMMULTIRANGEARRAYOID uint32 = 6151 TSMULTIRANGEARRAYOID uint32 = 6152 TSTZMULTIRANGEARRAYOID uint32 = 6153 DATEMULTIRANGEARRAYOID uint32 = 6155 INT8MULTIRANGEARRAYOID uint32 = 6157 )
Type OID constants.
const ( DEFAULT_COLLATION_OID uint32 = 100 // "default" collation C_COLLATION_OID uint32 = 950 // "C" collation )
Collation OID constants.
pg: src/include/catalog/pg_collation_d.h
const ( BooleanNotEqualOperator uint32 = 85 BooleanEqualOperator uint32 = 91 Int4EqualOperator uint32 = 96 Int4LessOperator uint32 = 97 TextEqualOperator uint32 = 98 NameEqualTextOperator uint32 = 254 NameLessTextOperator uint32 = 255 NameGreaterEqualTextOperator uint32 = 257 TIDEqualOperator uint32 = 387 Int8LessOperator uint32 = 412 OID_NAME_REGEXEQ_OP uint32 = 639 OID_TEXT_REGEXEQ_OP uint32 = 641 TextLessOperator uint32 = 664 TextGreaterEqualOperator uint32 = 667 Float8LessOperator uint32 = 672 OID_INET_SUB_OP uint32 = 931 OID_INET_SUBEQ_OP uint32 = 932 OID_INET_SUP_OP uint32 = 933 OID_INET_SUPEQ_OP uint32 = 934 BpcharEqualOperator uint32 = 1054 OID_BPCHAR_REGEXEQ_OP uint32 = 1055 BpcharLessOperator uint32 = 1058 BpcharGreaterEqualOperator uint32 = 1061 ARRAY_EQ_OP uint32 = 1070 ARRAY_LT_OP uint32 = 1072 ARRAY_GT_OP uint32 = 1073 OID_NAME_LIKE_OP uint32 = 1207 OID_TEXT_LIKE_OP uint32 = 1209 OID_BPCHAR_LIKE_OP uint32 = 1211 OID_NAME_ICREGEXEQ_OP uint32 = 1226 OID_TEXT_ICREGEXEQ_OP uint32 = 1228 OID_BPCHAR_ICREGEXEQ_OP uint32 = 1234 OID_NAME_ICLIKE_OP uint32 = 1625 OID_TEXT_ICLIKE_OP uint32 = 1627 OID_BPCHAR_ICLIKE_OP uint32 = 1629 ByteaEqualOperator uint32 = 1955 ByteaLessOperator uint32 = 1957 ByteaGreaterEqualOperator uint32 = 1960 OID_BYTEA_LIKE_OP uint32 = 2016 TextPatternLessOperator uint32 = 2314 TextPatternGreaterEqualOperator uint32 = 2317 BpcharPatternLessOperator uint32 = 2326 BpcharPatternGreaterEqualOperator uint32 = 2329 OID_ARRAY_OVERLAP_OP uint32 = 2750 OID_ARRAY_CONTAINS_OP uint32 = 2751 OID_ARRAY_CONTAINED_OP uint32 = 2752 TIDLessOperator uint32 = 2799 TIDGreaterOperator uint32 = 2800 TIDLessEqOperator uint32 = 2801 TIDGreaterEqOperator uint32 = 2802 OID_MULTIRANGE_LESS_OP uint32 = 2862 OID_MULTIRANGE_LESS_EQUAL_OP uint32 = 2863 OID_MULTIRANGE_GREATER_EQUAL_OP uint32 = 2864 OID_MULTIRANGE_GREATER_OP uint32 = 2865 OID_RANGE_OVERLAPS_MULTIRANGE_OP uint32 = 2866 OID_MULTIRANGE_OVERLAPS_RANGE_OP uint32 = 2867 OID_MULTIRANGE_OVERLAPS_MULTIRANGE_OP uint32 = 2868 OID_MULTIRANGE_CONTAINS_ELEM_OP uint32 = 2869 OID_MULTIRANGE_CONTAINS_RANGE_OP uint32 = 2870 OID_MULTIRANGE_CONTAINS_MULTIRANGE_OP uint32 = 2871 OID_MULTIRANGE_ELEM_CONTAINED_OP uint32 = 2872 OID_MULTIRANGE_RANGE_CONTAINED_OP uint32 = 2873 OID_MULTIRANGE_MULTIRANGE_CONTAINED_OP uint32 = 2874 OID_RANGE_OVERLAPS_LEFT_MULTIRANGE_OP uint32 = 2875 OID_MULTIRANGE_OVERLAPS_LEFT_RANGE_OP uint32 = 2876 OID_MULTIRANGE_OVERLAPS_LEFT_MULTIRANGE_OP uint32 = 2877 RECORD_EQ_OP uint32 = 2988 RECORD_LT_OP uint32 = 2990 RECORD_GT_OP uint32 = 2991 OID_INET_OVERLAP_OP uint32 = 3552 OID_RANGE_OVERLAPS_RIGHT_MULTIRANGE_OP uint32 = 3585 TextPrefixOperator uint32 = 3877 OID_RANGE_LESS_OP uint32 = 3884 OID_RANGE_LESS_EQUAL_OP uint32 = 3885 OID_RANGE_GREATER_EQUAL_OP uint32 = 3886 OID_RANGE_GREATER_OP uint32 = 3887 OID_RANGE_OVERLAP_OP uint32 = 3888 OID_RANGE_CONTAINS_ELEM_OP uint32 = 3889 OID_RANGE_CONTAINS_OP uint32 = 3890 OID_RANGE_ELEM_CONTAINED_OP uint32 = 3891 OID_RANGE_CONTAINED_OP uint32 = 3892 OID_RANGE_LEFT_OP uint32 = 3893 OID_RANGE_RIGHT_OP uint32 = 3894 OID_RANGE_OVERLAPS_LEFT_OP uint32 = 3895 OID_RANGE_OVERLAPS_RIGHT_OP uint32 = 3896 OID_MULTIRANGE_OVERLAPS_RIGHT_RANGE_OP uint32 = 4035 OID_MULTIRANGE_OVERLAPS_RIGHT_MULTIRANGE_OP uint32 = 4142 OID_RANGE_ADJACENT_MULTIRANGE_OP uint32 = 4179 OID_MULTIRANGE_ADJACENT_RANGE_OP uint32 = 4180 OID_MULTIRANGE_ADJACENT_MULTIRANGE_OP uint32 = 4198 OID_RANGE_LEFT_MULTIRANGE_OP uint32 = 4395 OID_MULTIRANGE_LEFT_RANGE_OP uint32 = 4396 OID_MULTIRANGE_LEFT_MULTIRANGE_OP uint32 = 4397 OID_RANGE_RIGHT_MULTIRANGE_OP uint32 = 4398 OID_MULTIRANGE_RIGHT_RANGE_OP uint32 = 4399 OID_MULTIRANGE_RIGHT_MULTIRANGE_OP uint32 = 4400 OID_RANGE_CONTAINS_MULTIRANGE_OP uint32 = 4539 OID_RANGE_MULTIRANGE_CONTAINED_OP uint32 = 4540 )
Operator OID constants.
const ( RelationRelationID uint32 = 1259 // pg_class TypeRelationID uint32 = 1247 // pg_type ConstraintRelationID uint32 = 2606 // pg_constraint ProcedureRelationID uint32 = 1255 // pg_proc TriggerRelationID uint32 = 2620 // pg_trigger NamespaceRelationID uint32 = 2615 // pg_namespace IndexRelationID uint32 = 2610 // pg_index (catalog, not the index itself) AttrDefaultRelID uint32 = 2604 // pg_attrdef SequenceRelationID uint32 = 2224 // pg_sequence_rel (class of seq relations is pg_class) )
const ( TYPTYPE_BASE = 'b' TYPTYPE_COMPOSITE = 'c' TYPTYPE_DOMAIN = 'd' TYPTYPE_ENUM = 'e' TYPTYPE_PSEUDO = 'p' TYPTYPE_RANGE = 'r' TYPTYPE_MULTIRANGE = 'm' )
Type kind constants (from pg_type.h TYPTYPE_*)
const ( PROKIND_FUNCTION = 'f' PROKIND_PROCEDURE = 'p' PROKIND_AGGREGATE = 'a' PROKIND_WINDOW = 'w' )
Function kind constants (from pg_proc.h PROKIND_*)
const INDEX_MAX_KEYS = 32
INDEX_MAX_KEYS is the maximum number of columns in an index.
pg: src/include/pg_config_manual.h — INDEX_MAX_KEYS
const MaxHeapAttributeNumber = 1600
MaxHeapAttributeNumber is the maximum number of columns allowed in a table.
pg: src/include/access/htup_details.h — MaxHeapAttributeNumber
const PARTITION_MAX_KEYS = 32
PARTITION_MAX_KEYS is the maximum number of partition key columns.
pg: src/include/pg_config_manual.h — PARTITION_MAX_KEYS
Variables ¶
var BuiltinCasts = [...]BuiltinCast{}/* 229 elements not displayed */
BuiltinCasts contains all 229 built-in PostgreSQL casts.
var BuiltinOperators = [...]BuiltinOperator{}/* 799 elements not displayed */
BuiltinOperators contains all 799 built-in PostgreSQL operators.
var BuiltinProcs = [...]BuiltinProc{}/* 3314 elements not displayed */
BuiltinProcs contains all 3314 built-in PostgreSQL functions.
var BuiltinTypes = [...]BuiltinType{}/* 193 elements not displayed */
BuiltinTypes contains all 193 built-in PostgreSQL types.
Functions ¶
This section is empty.
Types ¶
type AggExpr ¶
type AggExpr struct {
AggFuncOID uint32
AggName string // for deparse
ResultType uint32
Collation uint32 // result collation
Args []AnalyzedExpr
AggStar bool // count(*)
AggDistinct bool
}
AggExpr represents an aggregate function call.
pg: src/include/nodes/primnodes.h — Aggref
type AnalyzedExpr ¶
type AnalyzedExpr interface {
// contains filtered or unexported methods
}
AnalyzedExpr is the interface for post-analysis expression nodes.
pg: src/include/nodes/primnodes.h — Expr (base node) pg: src/backend/nodes/nodeFuncs.c — exprType, exprTypmod, exprCollation
type ArrayExprQ ¶
type ArrayExprQ struct {
ElementType uint32 // element type OID
ArrayType uint32 // array type OID
Elements []AnalyzedExpr
}
ArrayExprQ represents an ARRAY[...] constructor.
pg: src/include/nodes/primnodes.h — ArrayExpr
type BoolExprQ ¶
type BoolExprQ struct {
Op BoolOpType
Args []AnalyzedExpr
}
BoolExprQ represents an analyzed boolean expression (AND/OR/NOT).
pg: src/include/nodes/primnodes.h — BoolExpr
type BoolOpType ¶
type BoolOpType int
BoolOpType identifies a boolean operator.
const ( BoolAnd BoolOpType = iota BoolOr BoolNot )
type BoolTestType ¶
type BoolTestType int
BoolTestType identifies the kind of boolean test.
const ( BoolIsTrue BoolTestType = iota BoolIsNotTrue BoolIsFalse BoolIsNotFalse BoolIsUnknown BoolIsNotUnknown )
type BooleanTestExpr ¶
type BooleanTestExpr struct {
Arg AnalyzedExpr
TestType BoolTestType
}
BooleanTestExpr represents IS [NOT] TRUE/FALSE/UNKNOWN.
pg: src/include/nodes/primnodes.h — BooleanTest
type BuiltinCast ¶
type BuiltinCast struct {
Source uint32
Target uint32
Func uint32
Context byte // 'i'=implicit, 'a'=assignment, 'e'=explicit
Method byte // 'f'=function, 'b'=binary coercible, 'i'=I/O
}
BuiltinCast represents a built-in PostgreSQL type cast.
type BuiltinOperator ¶
type BuiltinOperator struct {
OID uint32
Name string
Kind byte // 'b'=binary, 'l'=prefix
CanMerge bool
CanHash bool
Left uint32 // 0 for prefix operators
Right uint32
Result uint32
Com uint32 // commutator OID
Negate uint32 // negator OID
Code uint32 // implementing function OID
Rest uint32 // restriction selectivity estimator
Join uint32 // join selectivity estimator
}
BuiltinOperator represents a built-in PostgreSQL operator.
type BuiltinProc ¶
type BuiltinProc struct {
OID uint32
Name string
Lang uint32
Cost float32
Rows float32
Variadic uint32
Support uint32
Kind byte // 'f'=function, 'a'=aggregate, 'w'=window, 'p'=procedure
SecDef bool
LeakProof bool
IsStrict bool
RetSet bool
Volatile byte // 'i'=immutable, 's'=stable, 'v'=volatile
Parallel byte // 's'=safe, 'r'=restricted, 'u'=unsafe
NArgs int16
NArgDefaults int16
RetType uint32
ArgTypes []uint32
AllArgTypes []uint32 // nil if IN only
ArgModes string // raw PG array, e.g. "{i,o,o}"
ArgNames string // raw PG array, e.g. "{name1,name2}"
}
BuiltinProc represents a built-in PostgreSQL function/procedure.
type BuiltinType ¶
type BuiltinType struct {
OID uint32
TypeName string
Namespace uint32
Len int16
ByVal bool
Type byte // 'b'=base, 'c'=composite, 'd'=domain, 'e'=enum, 'p'=pseudo, 'r'=range, 'm'=multirange
Category byte // type category for parser
IsPreferred bool
IsDefined bool
Delim byte
RelID uint32
Subscript uint32 // typsubscript function OID
Elem uint32 // element type for arrays
Array uint32 // array type OID
Input uint32 // input function OID
Output uint32 // output function OID
Receive uint32 // binary receive function OID
Send uint32 // binary send function OID
ModIn uint32 // typmod input function OID
ModOut uint32 // typmod output function OID
Analyze uint32 // analyze function OID
Align byte // 'c', 's', 'i', 'd'
Storage byte // 'p', 'e', 'x', 'm'
NotNull bool
BaseType uint32 // for domains
TypeMod int32
NDims int32
Collation uint32
}
BuiltinType represents a built-in PostgreSQL type.
type CaseExprQ ¶
type CaseExprQ struct {
Arg AnalyzedExpr // nil for searched CASE
When []*CaseWhenQ
Default AnalyzedExpr // nil if no ELSE
ResultType uint32
Collation uint32 // result collation
}
CaseExprQ represents an analyzed CASE expression. Named CaseExprQ to avoid collision with the raw CaseExpr in pgparser nodes.
pg: src/include/nodes/primnodes.h — CaseExpr
type CaseWhenQ ¶
type CaseWhenQ struct {
Condition AnalyzedExpr
Result AnalyzedExpr
}
CaseWhenQ represents a WHEN clause in a CASE expression.
pg: src/include/nodes/primnodes.h — CaseWhen
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog is the in-memory PostgreSQL catalog.
func New ¶
func New() *Catalog
New creates a fully initialized Catalog with all built-in data indexed.
func (*Catalog) AlterDomainStmt ¶
func (c *Catalog) AlterDomainStmt(stmt *nodes.AlterDomainStmt) error
AlterDomainStmt alters an existing domain from a parsed ALTER DOMAIN statement.
pg: src/backend/commands/typecmds.c — AlterDomainStmt
func (*Catalog) AlterEnumStmt ¶
func (c *Catalog) AlterEnumStmt(stmt *nodes.AlterEnumStmt) error
AlterEnumStmt handles ALTER TYPE ... ADD VALUE and ALTER TYPE ... RENAME VALUE.
pg: src/backend/commands/typecmds.c — AlterEnum
func (*Catalog) AlterFunction ¶
func (c *Catalog) AlterFunction(stmt *nodes.AlterFunctionStmt) error
AlterFunction alters a function's attributes.
pg: src/backend/commands/functioncmds.c — AlterFunction
func (*Catalog) AlterPolicy ¶
func (c *Catalog) AlterPolicy(stmt *nodes.AlterPolicyStmt) error
AlterPolicy modifies an existing row-level security policy.
pg: src/backend/commands/policy.c — AlterPolicy
func (*Catalog) AlterSequenceStmt ¶
func (c *Catalog) AlterSequenceStmt(stmt *nodes.AlterSeqStmt) error
AlterSequenceStmt alters an existing sequence from a parsed ALTER SEQUENCE statement.
pg: src/backend/commands/sequence.c — AlterSequence
func (*Catalog) AlterTableStmt ¶
func (c *Catalog) AlterTableStmt(stmt *nodes.AlterTableStmt) error
AlterTableStmt applies ALTER TABLE commands from a pgparser AST. Commands are sorted into passes before execution (DROP first, then TYPE, then ADD, then attribute changes), mirroring PG's multi-pass approach.
pg: src/backend/commands/tablecmds.c — AlterTable
func (*Catalog) CanCoerce ¶
CanCoerce returns true if source can be coerced to target in the given context.
func (*Catalog) Clone ¶
Clone creates a deep copy of the Catalog.
Builtin immutable data (casts, operators, builtin procs, builtin types) is shared by reference. All user-created objects are deep-copied so modifications to the clone do not affect the original, and vice versa.
func (*Catalog) CommentObject ¶
func (c *Catalog) CommentObject(stmt *nodes.CommentStmt) error
CommentObject sets or removes a comment on a catalog object from a pgparser AST.
pg: src/backend/commands/comment.c — CommentObject
func (*Catalog) ConstraintsOf ¶
func (c *Catalog) ConstraintsOf(relOID uint32) []*Constraint
ConstraintsOf returns all constraints on the given relation.
func (*Catalog) CreateCast ¶
func (c *Catalog) CreateCast(stmt *nodes.CreateCastStmt) error
CreateCast registers a user-defined cast.
pg: src/backend/commands/functioncmds.c — CreateCast
func (*Catalog) CreateFunctionStmt ¶
func (c *Catalog) CreateFunctionStmt(stmt *nodes.CreateFunctionStmt) error
CreateFunctionStmt creates a user-defined function or procedure from a pgparser AST.
pg: src/backend/commands/functioncmds.c — CreateFunction
func (*Catalog) CreatePolicy ¶
func (c *Catalog) CreatePolicy(stmt *nodes.CreatePolicyStmt) error
CreatePolicy creates a new row-level security policy on a table.
pg: src/backend/commands/policy.c — CreatePolicy
func (*Catalog) CreateSchemaCommand ¶
func (c *Catalog) CreateSchemaCommand(stmt *nodes.CreateSchemaStmt) error
CreateSchemaCommand creates a new schema in the catalog.
pg: src/backend/commands/schemacmds.c — CreateSchemaCommand
func (*Catalog) CreateTriggerStmt ¶
func (c *Catalog) CreateTriggerStmt(stmt *nodes.CreateTrigStmt) error
CreateTriggerStmt creates a new trigger on a relation from a pgparser AST.
pg: src/backend/commands/trigger.c — CreateTrigger
func (*Catalog) DefineAggregate ¶
func (c *Catalog) DefineAggregate(stmt *nodes.DefineStmt) error
DefineAggregate creates a user-defined aggregate function.
pg: src/backend/commands/aggregatecmds.c — DefineAggregate
func (*Catalog) DefineCompositeType ¶
func (c *Catalog) DefineCompositeType(stmt *nodes.CompositeTypeStmt) error
DefineCompositeType creates a new composite type from a parsed CREATE TYPE ... AS statement.
pg: src/backend/commands/typecmds.c — DefineCompositeType
func (*Catalog) DefineDomain ¶
func (c *Catalog) DefineDomain(stmt *nodes.CreateDomainStmt) error
DefineDomain creates a new domain type from a parsed CREATE DOMAIN statement.
pg: src/backend/commands/typecmds.c — DefineDomain
func (*Catalog) DefineEnum ¶
func (c *Catalog) DefineEnum(stmt *nodes.CreateEnumStmt) error
DefineEnum creates a new enum type from a parsed CREATE TYPE ... AS ENUM statement.
pg: src/backend/commands/typecmds.c — DefineEnum
func (*Catalog) DefineIndex ¶
DefineIndex creates a new index on a relation.
pg: src/backend/commands/indexcmds.c — DefineIndex
func (*Catalog) DefineOperator ¶
func (c *Catalog) DefineOperator(stmt *nodes.DefineStmt) error
DefineOperator creates a user-defined operator.
pg: src/backend/commands/operatorcmds.c — DefineOperator
func (*Catalog) DefineRange ¶
func (c *Catalog) DefineRange(stmt *nodes.CreateRangeStmt) error
DefineRange creates a new range type from a parsed CREATE TYPE ... AS RANGE statement.
pg: src/backend/commands/typecmds.c — DefineRange
func (*Catalog) DefineRelation ¶
func (c *Catalog) DefineRelation(stmt *nodes.CreateStmt, relkind byte) error
DefineRelation creates a new relation (table).
pg: src/backend/commands/tablecmds.c — DefineRelation
func (*Catalog) DefineSequence ¶
func (c *Catalog) DefineSequence(stmt *nodes.CreateSeqStmt) error
DefineSequence creates a new sequence from a parsed CREATE SEQUENCE statement.
pg: src/backend/commands/sequence.c — DefineSequence
func (*Catalog) DefineType ¶
func (c *Catalog) DefineType(stmt *nodes.DefineStmt) error
DefineType creates a new base type.
Two-phase protocol:
- Shell type (no parameters): creates an undefined shell entry.
- Full definition (with parameters): requires existing shell type, parses params, looks up I/O functions, registers the complete type + array type.
pg: src/backend/commands/typecmds.c — DefineType
func (*Catalog) DefineView ¶
DefineView creates a new view in the catalog.
pg: src/backend/commands/view.c — DefineView
func (*Catalog) DomainInfo ¶
func (c *Catalog) DomainInfo(typeOID uint32) *DomainType
DomainInfo returns the domain metadata for the given type OID, or nil.
func (*Catalog) DrainWarnings ¶
DrainWarnings returns all accumulated warnings and clears the buffer.
func (*Catalog) EnumValues ¶
EnumValues returns the labels of an enum type, or nil if not an enum.
func (*Catalog) Exec ¶
func (c *Catalog) Exec(sql string, opts *ExecOptions) ([]ExecResult, error)
Exec parses and executes one or more SQL statements against the catalog. DDL statements modify catalog state. DML, transaction control, and other non-utility statements are skipped (Skipped=true in the result).
pg: src/backend/tcop/postgres.c — exec_simple_query
func (*Catalog) ExecAlterObjectSchemaStmt ¶
func (c *Catalog) ExecAlterObjectSchemaStmt(stmt *nodes.AlterObjectSchemaStmt) error
ExecAlterObjectSchemaStmt moves an object to a different schema (SET SCHEMA).
pg: src/backend/commands/alter.c — ExecAlterObjectSchemaStmt
func (*Catalog) ExecCreateTableAs ¶
func (c *Catalog) ExecCreateTableAs(stmt *nodes.CreateTableAsStmt) error
ExecCreateTableAs creates a table or materialized view from a query (CREATE TABLE ... AS SELECT or CREATE MATERIALIZED VIEW ... AS SELECT).
pg: src/backend/commands/createas.c — ExecCreateTableAs
func (*Catalog) ExecGrantStmt ¶
ExecGrantStmt processes GRANT and REVOKE statements. For pgddl, grants are stored for catalog completeness but do not affect DDL semantics.
pg: src/backend/catalog/aclchk.c — ExecGrantStmt_oids
func (*Catalog) ExecRefreshMatView ¶
func (c *Catalog) ExecRefreshMatView(stmt *nodes.RefreshMatViewStmt) error
ExecRefreshMatView refreshes a materialized view. For pgddl, this is a no-op (no physical data to refresh) — just verifies the matview exists.
pg: src/backend/commands/matview.c — ExecRefreshMatView
func (*Catalog) ExecRenameStmt ¶
func (c *Catalog) ExecRenameStmt(stmt *nodes.RenameStmt) error
ExecRenameStmt handles RENAME operations from a pgparser AST.
pg: src/backend/commands/alter.c — ExecRenameStmt
func (*Catalog) ExecuteTruncate ¶
func (c *Catalog) ExecuteTruncate(stmt *nodes.TruncateStmt) error
ExecuteTruncate handles TRUNCATE TABLE. For pgddl (no physical data), this validates the targets and optionally resets owned sequence values for RESTART IDENTITY.
pg: src/backend/commands/tablecmds.c — ExecuteTruncate
func (*Catalog) FindCoercionPathway ¶
func (c *Catalog) FindCoercionPathway(source, target uint32, context byte) (CoercionPathway, uint32)
FindCoercionPathway returns the coercion pathway from source to target for the given context ('i'=implicit, 'a'=assignment, 'e'=explicit). The second return value is the cast function OID (0 for relabel/none).
func (*Catalog) FormatType ¶
FormatType formats a type OID and typmod into a human-readable type name.
func (*Catalog) GetComment ¶
GetComment returns the comment for the given object, if any.
func (*Catalog) GetIndexByOID ¶
GetIndexByOID returns the index with the given OID, or nil.
func (*Catalog) GetRelation ¶
GetRelation returns the relation in the given schema, or nil. If schema is empty, the search path is used.
func (*Catalog) GetRelationByOID ¶
GetRelationByOID returns the relation with the given OID, or nil.
func (*Catalog) GetViewDefinition ¶
GetViewDefinition returns the SQL definition of a view, matching pg_get_viewdef() output format.
pg: src/backend/utils/adt/ruleutils.c — pg_get_viewdef_worker
func (*Catalog) IsBinaryCoercible ¶
IsBinaryCoercible returns true if source can be cast to target as a no-op relabel.
func (*Catalog) LookupCast ¶
func (c *Catalog) LookupCast(source, target uint32) *BuiltinCast
LookupCast returns the cast from source to target, or nil.
func (*Catalog) LookupOperatorExact ¶
func (c *Catalog) LookupOperatorExact(name string, left, right uint32) []*BuiltinOperator
LookupOperatorExact returns the operators matching the exact signature.
func (*Catalog) LookupProcByName ¶
func (c *Catalog) LookupProcByName(name string) []*BuiltinProc
LookupProcByName returns all procs with the given name.
func (*Catalog) LookupProcByOID ¶
func (c *Catalog) LookupProcByOID(oid uint32) *BuiltinProc
LookupProcByOID returns the proc with the given OID, or nil.
func (*Catalog) ProcessUtility ¶
ProcessUtility dispatches a utility (DDL) statement to the appropriate handler.
pg: src/backend/tcop/utility.c — standard_ProcessUtility
func (*Catalog) QueryPgAttrdef ¶
func (c *Catalog) QueryPgAttrdef(relOID uint32) []PgAttrdefRow
QueryPgAttrdef returns pg_attrdef rows for a relation by OID.
(pgddl helper — PG uses SearchSysCache with pg_attrdef)
func (*Catalog) QueryPgAttribute ¶
func (c *Catalog) QueryPgAttribute(relOID uint32) []PgAttributeRow
QueryPgAttribute returns pg_attribute rows for a relation by OID.
(pgddl helper — PG uses ScanPgRelation/SearchSysCache with pg_attribute)
func (*Catalog) QueryPgClass ¶
func (c *Catalog) QueryPgClass(schemaName string) []PgClassRow
QueryPgClass returns pg_class rows for all objects in the given schema.
(pgddl helper — PG uses ScanPgRelation/SearchSysCache with pg_class)
func (*Catalog) QueryPgConstraint ¶
func (c *Catalog) QueryPgConstraint(relOID uint32) []PgConstraintRow
QueryPgConstraint returns pg_constraint rows for a relation by OID.
(pgddl helper — PG uses SearchSysCache with pg_constraint)
func (*Catalog) QueryPgDepend ¶
func (c *Catalog) QueryPgDepend() []PgDependRow
QueryPgDepend returns all pg_depend rows.
(pgddl helper — PG uses SearchSysCache with pg_depend)
func (*Catalog) QueryPgDescription ¶
func (c *Catalog) QueryPgDescription() []PgDescriptionRow
QueryPgDescription returns all pg_description rows.
(pgddl helper — PG uses SearchSysCache with pg_description)
func (*Catalog) QueryPgEnum ¶
QueryPgEnum returns pg_enum rows for an enum type by OID.
(pgddl helper — PG uses SearchSysCache with pg_enum)
func (*Catalog) QueryPgIndex ¶
func (c *Catalog) QueryPgIndex(relOID uint32) []PgIndexRow
QueryPgIndex returns pg_index rows for a relation by OID.
(pgddl helper — PG uses SearchSysCache with pg_index)
func (*Catalog) QueryPgInherits ¶
func (c *Catalog) QueryPgInherits() []PgInheritsRow
QueryPgInherits returns all pg_inherits rows.
(pgddl helper — PG uses SearchSysCache with pg_inherits)
func (*Catalog) QueryPgNamespace ¶
func (c *Catalog) QueryPgNamespace() []PgNamespaceRow
QueryPgNamespace returns all user-created schemas as pg_namespace rows.
(pgddl helper — PG uses ScanPgRelation/SearchSysCache with pg_namespace)
func (*Catalog) QueryPgPolicy ¶
func (c *Catalog) QueryPgPolicy(relOID uint32) []PgPolicyRow
QueryPgPolicy returns pg_policy rows for the given relation OID. If relOID is 0, returns all policies.
pg: src/include/catalog/pg_policy.h
func (*Catalog) QueryPgProc ¶
QueryPgProc returns pg_proc rows for user-created functions in a schema.
(pgddl helper — PG uses SearchSysCache with pg_proc)
func (*Catalog) QueryPgSequence ¶
func (c *Catalog) QueryPgSequence(schemaName string) []PgSequenceRow
QueryPgSequence returns pg_sequence rows for all sequences in a schema.
(pgddl helper — PG uses SearchSysCache with pg_sequence)
func (*Catalog) QueryPgTrigger ¶
func (c *Catalog) QueryPgTrigger(relOID uint32) []PgTriggerRow
QueryPgTrigger returns pg_trigger rows for a relation by OID.
(pgddl helper — PG uses SearchSysCache with pg_trigger)
func (*Catalog) QueryPgType ¶
QueryPgType returns pg_type rows for user-created types in a schema.
(pgddl helper — PG uses SearchSysCache with pg_type)
func (*Catalog) RemoveObjects ¶
RemoveObjects dispatches DROP statements for non-relation object types. Handles OBJECT_INDEX, OBJECT_SEQUENCE, OBJECT_TYPE, OBJECT_FUNCTION, OBJECT_PROCEDURE, and OBJECT_TRIGGER.
For OBJECT_TABLE and OBJECT_VIEW, use RemoveRelations instead. For OBJECT_SCHEMA, use RemoveSchemas instead.
pg: src/backend/commands/dropcmds.c — RemoveObjects
func (*Catalog) RemoveRelations ¶
RemoveRelations handles DROP TABLE/VIEW/MATERIALIZED VIEW for one or more objects.
pg: src/backend/commands/tablecmds.c — RemoveRelations
func (*Catalog) RemoveSchemas ¶
RemoveSchemas drops one or more schemas from the catalog. Called from RemoveObjects when the drop target is OBJECT_SCHEMA.
pg: src/backend/commands/schemacmds.c — (drop case in RemoveObjects via dropcmds.c)
func (*Catalog) ResolveType ¶
ResolveType resolves a TypeName to an OID and typmod.
func (*Catalog) SelectCommonType ¶
SelectCommonType picks a common type from a set of type OIDs. UNKNOWNOID inputs are ignored; if all are UNKNOWN the result is TEXTOID.
func (*Catalog) SequencesOf ¶
SequencesOf returns all sequences in the given schema.
func (*Catalog) SetSearchPath ¶
SetSearchPath sets the schema search path by name. Non-existent schemas are accepted and silently skipped at lookup time, matching PostgreSQL's behavior.
pg: src/backend/utils/init/postinit.c — InitializeSearchPath
func (*Catalog) TriggersOf ¶
TriggersOf returns all triggers on the given relation.
func (*Catalog) TypeByOID ¶
func (c *Catalog) TypeByOID(oid uint32) *BuiltinType
TypeByOID returns the type with the given OID, or nil.
func (*Catalog) UserSchemas ¶
UserSchemas returns all user-created schemas (excludes pg_catalog, pg_toast). Schemas are returned sorted by OID.
type CoalesceExprQ ¶
type CoalesceExprQ struct {
Args []AnalyzedExpr
ResultType uint32
Collation uint32 // result collation
}
CoalesceExprQ represents an analyzed COALESCE expression.
pg: src/include/nodes/primnodes.h — CoalesceExpr
type CoerceViaIOExpr ¶
type CoerceViaIOExpr struct {
Arg AnalyzedExpr
ResultType uint32
Collation uint32 // result collation
Format byte // 'e'=explicit, 'i'=implicit
}
CoerceViaIOExpr represents a type cast via I/O conversion.
pg: src/include/nodes/primnodes.h — CoerceViaIO
type CoercionPathway ¶
type CoercionPathway int
CoercionPathway describes how a type cast is performed.
const ( CoercionNone CoercionPathway = iota // no coercion possible CoercionRelabel // binary compatible (no-op cast) CoercionFunc // cast via function CoercionIO // cast via I/O conversion )
type CollateExprQ ¶
type CollateExprQ struct {
Arg AnalyzedExpr
CollOID uint32 // collation OID (0 if not resolved)
CollName string // collation name for deparse
}
CollateExprQ represents an expr COLLATE "name" expression.
pg: src/include/nodes/primnodes.h — CollateExpr
type Column ¶
type Column struct {
AttNum int16
Name string
TypeOID uint32
TypeMod int32
NotNull bool
HasDefault bool
Default string
Len int16
ByVal bool
Align byte
Storage byte
Collation uint32
Generated byte // 's' = stored generated, 0 = none
Identity byte // 'a' = ALWAYS, 'd' = BY DEFAULT, 0 = none
IsLocal bool // true if defined locally (not only inherited)
InhCount int // number of inheritance ancestors that define this column
Compression byte // attcompression: 'p'=pglz, 'l'=lz4, 0=default
GenerationExpr string // expression text for generated columns
CollationName string // explicit collation name (empty = type default)
Ndims int16 // attndims — declared array dimensions
}
Column represents a table column.
type ColumnDef ¶
type ColumnDef struct {
Name string
Type TypeName
NotNull bool
Default string // opaque expression; empty = no default
IsSerial byte // 0=none, 2=smallserial, 4=serial, 8=bigserial
Generated byte // 's' = stored generated, 0 = none
GenerationExpr string // expression text for generated column
Identity byte // 'a' = ALWAYS, 'd' = BY DEFAULT, 0 = none
IsLocal bool // true if defined locally (not only inherited)
InhCount int // number of inheritance ancestors that define this column
CollationName string // explicit COLLATE clause; empty = type default
IsFromType bool // true if column came from OF TYPE (typed table)
}
ColumnDef describes a column in a CREATE TABLE statement.
type CommonTableExprQ ¶
type CommonTableExprQ struct {
Name string
Aliases []string // explicit column aliases
Query *Query
Recursive bool
Materialized int // 0=default, 1=materialized, 2=not materialized
}
CommonTableExprQ represents an analyzed CTE.
pg: src/include/nodes/parsenodes.h — CommonTableExpr
type ConstExpr ¶
type ConstExpr struct {
TypeOID uint32
TypeMod int32
Collation uint32 // collation OID
IsNull bool
Value string // textual representation
}
ConstExpr represents a typed constant.
pg: src/include/nodes/primnodes.h — Const
type Constraint ¶
type Constraint struct {
OID uint32
Name string
Type ConstraintType
RelOID uint32
Namespace uint32 // connamespace (schema OID)
Columns []int16 // attnums
FRelOID uint32 // FK: referenced relation OID
FColumns []int16 // FK: referenced attnums
FKUpdAction byte // FK: 'a'=NO ACTION, 'r'=RESTRICT, 'c'=CASCADE, 'n'=SET NULL, 'd'=SET DEFAULT
FKDelAction byte // FK: same codes
FKMatchType byte // FK: 's'=SIMPLE, 'f'=FULL, 'p'=PARTIAL
Deferrable bool // condeferrable
Deferred bool // condeferred
Validated bool // convalidated
CheckExpr string // CHECK: opaque expression
IndexOID uint32 // PK/UNIQUE/EXCLUDE: backing index OID
ExclOps []string // EXCLUDE only: operator names per column
// Inheritance/partition fields.
// pg: src/include/catalog/pg_constraint.h lines 89-108
ConParentID uint32 // parent constraint OID (partitions)
ConIsLocal bool // locally defined (not only inherited)
ConInhCount int16 // inheritance count
ConNoInherit bool // cannot be inherited
// FK operator arrays.
// pg: src/include/catalog/pg_constraint.h lines 123-145
PFEqOp []uint32 // FK: PK=FK equality operators
PPEqOp []uint32 // FK: PK=PK equality operators
FFEqOp []uint32 // FK: FK=FK equality operators
FKDelSetCols []int16 // FK: subset of columns for ON DELETE SET NULL/DEFAULT
}
Constraint represents a table constraint.
pg: src/include/catalog/pg_constraint.h
type ConstraintDef ¶
type ConstraintDef struct {
Name string // empty = auto-generate
Type ConstraintType
Columns []string // PK/UNIQUE/FK local columns
RefSchema string // FK only
RefTable string // FK only
RefColumns []string // FK only (empty = use PK of target)
FKUpdAction byte // FK only: 'a', 'r', 'c', 'n', 'd'
FKDelAction byte // FK only: 'a', 'r', 'c', 'n', 'd'
FKMatchType byte // FK only: 's', 'f', 'p'
Deferrable bool // DEFERRABLE
Deferred bool // INITIALLY DEFERRED
SkipValidation bool // NOT VALID (CHECK/FK only)
CheckExpr string // CHECK only
ExclOps []string // EXCLUDE only: operator names per column
AccessMethod string // EXCLUDE only: access method (default "gist")
}
ConstraintDef describes a constraint in a CREATE TABLE statement.
type ConstraintType ¶
type ConstraintType byte
ConstraintType identifies the kind of table constraint.
const ( ConstraintPK ConstraintType = 'p' ConstraintUnique ConstraintType = 'u' ConstraintFK ConstraintType = 'f' ConstraintCheck ConstraintType = 'c' ConstraintExclude ConstraintType = 'x' )
type DepEntry ¶
type DepEntry struct {
ObjType byte // 'r'=relation, 'i'=index, 'c'=constraint, 't'=type
ObjOID uint32
RefType byte
RefOID uint32
DepType DepType
}
DepEntry records a dependency between two catalog objects.
type DepType ¶
type DepType byte
DepType classifies a dependency.
const ( DepNormal DepType = 'n' // requires CASCADE to drop referent DepAuto DepType = 'a' // auto-dropped with referent DepInternal DepType = 'i' // inseparable from referent DepPartitionPri DepType = 'P' // partition object → parent object DepPartitionSec DepType = 'S' // partition object → partition table )
type DistinctExprQ ¶
type DistinctExprQ struct {
OpOID uint32
OpName string
ResultType uint32
Left AnalyzedExpr
Right AnalyzedExpr
IsNot bool // true for IS NOT DISTINCT FROM
}
DistinctExprQ represents IS [NOT] DISTINCT FROM. In PG, DistinctExpr is derived from OpExpr; the deparser checks the node tag.
pg: src/include/nodes/primnodes.h — DistinctExpr
type DomainConstraint ¶
type DomainConstraint struct {
OID uint32
Name string
DomainOID uint32
CheckExpr string
ConValidated bool // true if constraint has been validated
}
DomainConstraint represents a CHECK constraint on a domain.
type DomainType ¶
type DomainType struct {
TypeOID uint32
BaseTypeOID uint32
BaseTypMod int32
NotNull bool
Default string
Constraints []*DomainConstraint
}
DomainType holds metadata for a user-created domain type.
type EnumType ¶
type EnumType struct {
TypeOID uint32
Values []*EnumValue
// contains filtered or unexported fields
}
EnumType holds the metadata for a user-created enum type.
type ExecOptions ¶
type ExecOptions struct {
// ContinueOnError, when true, continues executing subsequent statements
// after a failure, collecting all errors. When false (default), execution
// stops at the first error.
ContinueOnError bool
}
ExecOptions controls execution behavior.
type ExecResult ¶
type ExecResult struct {
Index int // statement position in the batch (0-based)
SQL string // original SQL text for this statement
Line int // 1-based start line in the original SQL
Skipped bool // true if the statement was not processed (DML, etc.)
Error error // nil = success or skipped
Warnings []Warning // non-fatal notices emitted during execution
}
ExecResult is the execution result for a single statement.
type FieldSelectExprQ ¶
type FieldSelectExprQ struct {
Arg AnalyzedExpr
FieldNum int16 // attribute number (1-based)
FieldName string // for deparse
ResultType uint32
TypeMod int32
Collation uint32 // result collation
}
FieldSelectExprQ represents a composite.field selection.
pg: src/include/nodes/primnodes.h — FieldSelect
type FuncCallExpr ¶
type FuncCallExpr struct {
FuncOID uint32
FuncName string // for deparse
ResultType uint32
ResultTypMod int32
Collation uint32 // result collation
Args []AnalyzedExpr
CoerceFormat byte // 0=normal func, 'e'=explicit cast, 'i'=implicit cast
}
FuncCallExpr represents a resolved function call.
pg: src/include/nodes/primnodes.h — FuncExpr
type Grant ¶
type Grant struct {
ObjType byte // 'r'=relation, 's'=sequence, 'f'=function, 'n'=schema
ObjOID uint32 // OID of the object
Grantee string // role name ("" = PUBLIC)
Privilege string // SELECT, INSERT, UPDATE, DELETE, REFERENCES, TRIGGER, EXECUTE, USAGE, CREATE, ALL
Columns []string
WithGrant bool
}
Grant represents a recorded privilege grant.
type GroupingSetKind ¶
type GroupingSetKind int
GroupingSetKind identifies the type of grouping set.
const ( GroupingSetSimple GroupingSetKind = iota // plain GROUP BY column GroupingSetRollup // ROLLUP(...) GroupingSetCube // CUBE(...) GroupingSetSets // GROUPING SETS((...), (...)) )
type GroupingSetQ ¶
type GroupingSetQ struct {
Kind GroupingSetKind
Content []*SortGroupClause // the columns in this set
Sets []*GroupingSetQ // for GROUPING SETS containing nested sets
}
GroupingSetQ represents GROUPING SETS / CUBE / ROLLUP.
pg: src/include/nodes/parsenodes.h — GroupingSet
type Index ¶
type Index struct {
OID uint32
Name string
Schema *Schema
RelOID uint32
Columns []int16 // attnums (0 = expression column)
IsUnique bool
IsPrimary bool
IsClustered bool // indisclustered
IsReplicaIdent bool // indisreplident
ConstraintOID uint32 // 0 if standalone
AccessMethod string // "btree" (default), "hash", "gist", "gin", "brin"
NKeyColumns int // number of key columns (rest are INCLUDE); 0 = all are key
WhereClause string // opaque WHERE predicate string; empty = no partial index
IndOption []int16 // per-column flags: bit0=DESC, bit1=NULLS_FIRST
NullsNotDistinct bool // NULLS NOT DISTINCT for unique indexes
}
Index represents an index on a relation.
type InhEntry ¶
type InhEntry struct {
InhRelID uint32 // child relation OID
InhParent uint32 // parent relation OID
InhSeqNo int32 // order in INHERITS list (1-based)
}
InhEntry represents a row in pg_inherits.
type JoinExprNode ¶
type JoinExprNode struct {
JoinType JoinType
Left JoinNode
Right JoinNode
Quals AnalyzedExpr // ON condition
RTIndex int // this join's RTE index
}
JoinExprNode represents a JOIN expression in the FROM clause.
pg: src/include/nodes/primnodes.h — JoinExpr
type JoinNode ¶
type JoinNode interface {
// contains filtered or unexported methods
}
JoinNode is the interface for FROM clause items.
type JoinTree ¶
type JoinTree struct {
FromList []JoinNode // top-level FROM items
Quals AnalyzedExpr // WHERE condition (may be nil)
}
JoinTree represents the FROM clause structure.
pg: src/include/nodes/primnodes.h — FromExpr
type MinMaxExprQ ¶
type MinMaxExprQ struct {
Op MinMaxOp // IS_GREATEST or IS_LEAST
Args []AnalyzedExpr
ResultType uint32
Collation uint32 // result collation
}
MinMaxExprQ represents GREATEST/LEAST.
pg: src/include/nodes/primnodes.h — MinMaxExpr
type NullIfExprQ ¶
type NullIfExprQ struct {
OpOID uint32
Args []AnalyzedExpr // exactly 2 args
ResultType uint32
}
NullIfExprQ represents an analyzed NULLIF expression. Named NullIfExprQ to avoid collision with pgparser's NullIfExpr.
pg: src/include/nodes/primnodes.h — NullIfExpr (derived from OpExpr)
type NullTestExpr ¶
type NullTestExpr struct {
Arg AnalyzedExpr
IsNull bool // true=IS NULL, false=IS NOT NULL
}
NullTestExpr represents IS [NOT] NULL.
pg: src/include/nodes/primnodes.h — NullTest
type OIDGenerator ¶
type OIDGenerator struct {
// contains filtered or unexported fields
}
OIDGenerator allocates monotonically increasing OIDs starting at FirstNormalObjectId.
func NewOIDGenerator ¶
func NewOIDGenerator() *OIDGenerator
NewOIDGenerator returns a generator starting at FirstNormalObjectId.
func (*OIDGenerator) Next ¶
func (g *OIDGenerator) Next() uint32
Next returns the next available OID.
type OpExpr ¶
type OpExpr struct {
OpOID uint32
OpName string // for deparse
ResultType uint32
Collation uint32 // result collation
Left AnalyzedExpr // nil for prefix
Right AnalyzedExpr
}
OpExpr represents a resolved operator expression.
pg: src/include/nodes/primnodes.h — OpExpr
type PartitionBound ¶
type PartitionBound struct {
Strategy byte // must match parent's strategy
IsDefault bool
ListValues []string // deparsed datum strings (LIST)
LowerBound []string // deparsed lower bound values (RANGE)
UpperBound []string // deparsed upper bound values (RANGE)
Modulus int // HASH modulus
Remainder int // HASH remainder
}
PartitionBound stores partition bound for a partition child.
type PartitionInfo ¶
type PartitionInfo struct {
Strategy byte // 'l'=list, 'r'=range, 'h'=hash
KeyAttNums []int16 // partition key column attnums
NKeyAttrs int16
}
PartitionInfo stores partition key information for a partitioned table.
type PgAttrdefRow ¶
type PgAttrdefRow struct {
OID uint32
AdRelID uint32
AdNum int16
AdBin string // pg_get_expr(adbin) text
}
PgAttrdefRow mirrors pg_attrdef.
type PgAttributeRow ¶
type PgAttributeRow struct {
AttRelID uint32
AttName string
AttTypID uint32
AttNum int16
AttTypMod int32
AttLen int16
AttByVal bool
AttAlign byte
AttStorage byte
AttNotNull bool
AttHasDef bool
AttIsDropped bool
AttCollation uint32
AttGenerated byte // 's' = stored generated, 0 = none
AttIdentity byte // 'a' = ALWAYS, 'd' = BY DEFAULT, 0 = none
AttIsLocal bool // true if defined locally
AttInhCount int // number of inheritance ancestors
}
PgAttributeRow mirrors pg_attribute.
type PgClassRow ¶
type PgClassRow struct {
OID uint32
RelName string
RelNamespace uint32
RelType uint32 // composite type OID
RelKind byte // 'r', 'v', 'i', 'S'
RelNatts int16
RelChecks int16
RelHasTriggers bool
RelHasIndex bool
RelPersistence byte // 'p'=permanent, 'u'=unlogged, 't'=temp
ReplicaIdentity byte // 'd'=default, 'f'=full, 'n'=nothing, 'i'=index
RelOfType uint32 // reloftype — 0 if not a typed table
}
PgClassRow mirrors pg_class (subset of columns relevant to DDL).
type PgConstraintRow ¶
type PgConstraintRow struct {
OID uint32
ConName string
ConNamespace uint32
ConType byte // 'c', 'f', 'p', 'u'
ConRelID uint32
ConTypID uint32 // for domain constraints
ConKey []int16 // constrained columns
ConFRelID uint32 // FK: referenced relation
ConFKey []int16 // FK: referenced columns
ConFUpdType byte // FK: ON UPDATE action
ConFDelType byte // FK: ON DELETE action
ConFMatchType byte // FK: match type
ConDeferrable bool
ConDeferred bool
ConValidated bool
ConIndexID uint32 // backing index (PK/UNIQUE)
ConExpr string // CHECK expression text
// Inheritance/partition fields.
ConParentID uint32 // parent constraint OID
ConIsLocal bool // locally defined
ConInhCount int16 // inheritance count
ConNoInherit bool // cannot be inherited
// FK operator arrays.
PFEqOp []uint32 // PK=FK equality operators
PPEqOp []uint32 // PK=PK equality operators
FFEqOp []uint32 // FK=FK equality operators
FKDelSetCols []int16 // ON DELETE SET NULL/DEFAULT column subset
}
PgConstraintRow mirrors pg_constraint.
type PgDependRow ¶
type PgDependRow struct {
ClassID uint32
ObjID uint32
RefClassID uint32
RefObjID uint32
DepType byte
}
PgDependRow mirrors pg_depend.
type PgDescriptionRow ¶
PgDescriptionRow mirrors pg_description.
type PgIndexRow ¶
type PgIndexRow struct {
IndexRelID uint32
IndRelID uint32
IndNatts int16
IndNKeyAtts int16
IndIsUnique bool
IndIsPrimary bool
IndIsClustered bool
IndIsReplIdent bool
IndKey []int16
IndOption []int16
}
PgIndexRow mirrors pg_index.
type PgInheritsRow ¶
type PgInheritsRow struct {
InhRelID uint32 // child relation OID
InhParent uint32 // parent relation OID
InhSeqNo int32 // order in INHERITS list (1-based)
}
PgInheritsRow mirrors pg_inherits.
type PgNamespaceRow ¶
PgNamespaceRow mirrors pg_namespace.
type PgPolicyRow ¶
type PgPolicyRow struct {
OID uint32
PolName string
PolRelID uint32
PolCmd string // "all", "select", "insert", "update", "delete"
Permissive bool
Roles []string
PolQual string // USING expression
PolCheck string // WITH CHECK expression
}
PgPolicyRow mirrors pg_policy.
type PgProcRow ¶
type PgProcRow struct {
OID uint32
ProName string
ProNamespace uint32
ProKind byte // 'f', 'p'
ProArgTypes []uint32
ProRetType uint32
ProRetSet bool
ProIsStrict bool
ProVolatile byte
ProParallel byte
}
PgProcRow mirrors pg_proc (user-created only).
type PgSequenceRow ¶
type PgSequenceRow struct {
SeqRelID uint32
SeqTypID uint32
SeqStart int64
SeqIncrement int64
SeqMax int64
SeqMin int64
SeqCache int64
SeqCycle bool
}
PgSequenceRow mirrors pg_sequence.
type PgTriggerRow ¶
type PgTriggerRow struct {
OID uint32
TgRelID uint32
TgName string
TgFOID uint32
TgType int16
TgEnabled byte
TgAttr []int16
}
PgTriggerRow mirrors pg_trigger.
type PgTypeRow ¶
type PgTypeRow struct {
OID uint32
TypName string
TypNamespace uint32
TypLen int16
TypByVal bool
TypType byte // 'b', 'c', 'd', 'e'
TypCategory byte
TypIsDefined bool
TypDelim byte
TypRelID uint32 // for composite types
TypElem uint32 // array element type
TypArray uint32 // corresponding array type
TypBaseType uint32 // for domains
TypTypMod int32
TypAlign byte
TypStorage byte
TypNotNull bool
TypCollation uint32
}
PgTypeRow mirrors pg_type.
type Policy ¶
type Policy struct {
OID uint32
Name string
RelOID uint32
CmdType string // "all", "select", "insert", "update", "delete"
Permissive bool
Roles []string
UsingExpr string // deparsed USING expression
CheckExpr string // deparsed WITH CHECK expression
}
Policy represents a row-level security policy.
type Query ¶
type Query struct {
TargetList []*TargetEntry
RangeTable []*RangeTableEntry
JoinTree *JoinTree
GroupClause []*SortGroupClause
HavingQual AnalyzedExpr
SortClause []*SortGroupClause
LimitCount AnalyzedExpr
LimitOffset AnalyzedExpr
SetOp SetOpType // SetOpNone for simple SELECT
AllSetOp bool // true for ALL variants
LArg *Query // left side of set op
RArg *Query // right side of set op
Distinct bool // SELECT DISTINCT
DistinctOn []*SortGroupClause
HasAggs bool
CTEList []*CommonTableExprQ // WITH clause CTEs
WindowClause []*WindowClauseQ // WINDOW clause
IsRecursive bool // WITH RECURSIVE
}
Query represents an analyzed SELECT statement.
pg: src/include/nodes/parsenodes.h — Query
type RangeTableEntry ¶
type RangeTableEntry struct {
Kind RTEKind
RelOID uint32 // for RTERelation
RelName string // original table name
SchemaName string // schema name (for deparse)
Alias string // user-provided alias (empty = none)
ERef string // effective reference name for deparse
ColNames []string // column names visible from this RTE
ColTypes []uint32 // column type OIDs
ColTypMods []int32 // column type modifiers
ColCollations []uint32 // column collation OIDs
Subquery *Query // for RTESubquery
JoinType JoinType // for RTEJoin
Lateral bool // LATERAL subquery or function
CTEName string // for RTECTE: name of referenced CTE
CTEIndex int // for RTECTE: index into Query.CTEList
}
RangeTableEntry represents an entry in the query's range table.
pg: src/include/nodes/parsenodes.h — RangeTblEntry
type RangeTableRef ¶
type RangeTableRef struct {
RTIndex int // index into RangeTable (0-based)
}
RangeTableRef references a range table entry.
pg: src/include/nodes/primnodes.h — RangeTblRef
type RangeType ¶
type RangeType struct {
OID uint32
Name string
Namespace uint32
SubTypeOID uint32
ArrayOID uint32
MultirangeOID uint32 // auto-generated multirange type
}
RangeType holds the metadata for a user-created range type.
type RelabelExpr ¶
type RelabelExpr struct {
Arg AnalyzedExpr
ResultType uint32
TypeMod int32
Collation uint32 // result collation
Format byte // 'e'=explicit, 'i'=implicit
}
RelabelExpr represents a binary-compatible type cast (no-op).
pg: src/include/nodes/primnodes.h — RelabelType
type Relation ¶
type Relation struct {
OID uint32
Name string
Schema *Schema
RelKind byte // 'r'=table, 'v'=view, 'c'=composite, 'p'=partitioned, 'm'=matview
Columns []*Column
RowTypeOID uint32
ArrayOID uint32
AnalyzedQuery *Query // non-nil for views (analyzed form, for deparse)
// Persistence (pg_class.relpersistence).
Persistence byte // 'p'=permanent, 'u'=unlogged, 't'=temp (default 'p')
ReplicaIdentity byte // 'd'=default, 'f'=full, 'n'=nothing, 'i'=index
OfTypeOID uint32 // reloftype — 0 if not a typed table
// Inheritance (pg_inherits).
InhParents []uint32 // parent relation OIDs
InhCount int // number of inheritance parents
// Partitioning.
PartitionInfo *PartitionInfo // non-nil if PARTITION BY (partitioned table)
PartitionBound *PartitionBound // non-nil if PARTITION OF (partition)
PartitionOf uint32 // parent partitioned table OID (0 if not a partition)
// Row-level security.
RowSecurity bool // relrowsecurity
ForceRowSecurity bool // relforcerowsecurity
// View options.
CheckOption byte // 0=none, 'l'=LOCAL, 'c'=CASCADED (views only)
// ON COMMIT behavior for temp tables.
OnCommit byte // 0=noop, 'p'=preserve rows, 'd'=delete rows, 'D'=drop
// Relation flags (pg_class).
Owner uint32 // relowner
HasRules bool // relhasrules
HasSubclass bool // relhassubclass — has child tables/partitions
IsPopulated bool // relispopulated — matview populated state
IsPartition bool // relispartition
// contains filtered or unexported fields
}
Relation represents a table, view, or other relation.
type ResultColumn ¶
ResultColumn is the output of SELECT type inference.
pg: src/backend/commands/view.c — DefineVirtualRelation (column metadata)
type RowExprQ ¶
type RowExprQ struct {
Args []AnalyzedExpr
ResultType uint32 // RECORDOID typically
RowFormat byte // 0=implicit, 'e'=explicit ROW keyword
}
RowExprQ represents a ROW(...) or (...) expression.
pg: src/include/nodes/primnodes.h — RowExpr
type SQLValueFuncExpr ¶
SQLValueFuncExpr represents CURRENT_DATE, CURRENT_TIMESTAMP, etc.
pg: src/include/nodes/primnodes.h — SQLValueFunction
type ScalarArrayOpExpr ¶
type ScalarArrayOpExpr struct {
OpOID uint32
OpName string
UseOr bool // true for ANY (=IN), false for ALL
Left AnalyzedExpr
Right []AnalyzedExpr // the array elements
ResultType uint32
}
ScalarArrayOpExpr represents op ANY/ALL (array). Used for IN-list expansion: x IN (a,b,c) → x = ANY(ARRAY[a,b,c]).
pg: src/include/nodes/primnodes.h — ScalarArrayOpExpr
type Schema ¶
type Schema struct {
OID uint32
Name string
Owner string // role name of the schema owner (empty = current user)
Relations map[string]*Relation
Indexes map[string]*Index
Sequences map[string]*Sequence
}
Schema represents a PostgreSQL namespace.
type Sequence ¶
type Sequence struct {
OID uint32
Name string
Schema *Schema
TypeOID uint32 // int2/int4/int8
Start int64
Increment int64
MinValue int64
MaxValue int64
CacheValue int64
Cycle bool
OwnerRelOID uint32 // 0 if not owned
OwnerAttNum int16
}
Sequence represents a PostgreSQL sequence.
type SortGroupClause ¶
type SortGroupClause struct {
TLESortGroupRef uint32 // index into TargetList (0-based)
Descending bool
NullsFirst bool
}
SortGroupClause identifies an output column for ORDER BY / GROUP BY.
pg: src/include/nodes/parsenodes.h — SortGroupClause
type SubLinkExpr ¶
type SubLinkExpr struct {
SubLinkType SubLinkType
SubQuery *Query
ResultType uint32
}
SubLinkExpr represents a subquery expression (scalar or EXISTS).
pg: src/include/nodes/primnodes.h — SubLink
type SubLinkType ¶
type SubLinkType int
SubLinkType identifies the kind of subquery.
const ( SubLinkExprType SubLinkType = iota // scalar subquery SubLinkExistsType // EXISTS subquery SubLinkAnyType // ANY/IN subquery SubLinkAllType // ALL subquery )
type TargetEntry ¶
type TargetEntry struct {
Expr AnalyzedExpr
ResNo int16 // position (1-based)
ResName string // output column name
ResJunk bool // hidden (ORDER BY helper)
ResOrigTbl uint32 // source table OID (for provenance)
ResOrigCol int16 // source column number
ResSortGroupRef uint32 // nonzero if referenced by GROUP BY/ORDER BY
}
TargetEntry represents a column in the SELECT list.
pg: src/include/nodes/primnodes.h — TargetEntry
type Trigger ¶
type Trigger struct {
OID uint32
Name string
RelOID uint32
FuncOID uint32
Timing TriggerTiming
Events TriggerEvent
ForEachRow bool
WhenExpr string
Columns []int16 // UPDATE OF columns; nil = all
Enabled byte // 'O'=origin(enabled), 'D'=disabled, 'A'=always, 'R'=replica
OldTransitionName string // OLD TABLE AS name (transition tables)
NewTransitionName string // NEW TABLE AS name (transition tables)
IsConstraint bool // constraint trigger (pg: tgconstraint != 0)
ConstraintRelOID uint32 // referenced relation for FK constraint triggers
Args []string // trigger function arguments
}
Trigger represents a trigger on a relation.
type TriggerEvent ¶
type TriggerEvent uint8
TriggerEvent is a bitmask of trigger events.
const ( TriggerEventInsert TriggerEvent = 1 << iota TriggerEventUpdate TriggerEventDelete TriggerEventTruncate )
type TriggerTiming ¶
type TriggerTiming byte
TriggerTiming indicates when a trigger fires.
const ( TriggerBefore TriggerTiming = 'B' TriggerAfter TriggerTiming = 'A' TriggerInsteadOf TriggerTiming = 'I' )
type TypeName ¶
type TypeName struct {
Schema string // empty = use search path
Name string
TypeMod int32 // -1 = no typmod
IsArray bool
}
TypeName identifies a type for resolution.
type UserProc ¶
type UserProc struct {
OID uint32
Name string
Schema *Schema
Kind byte // 'f' or 'p'
ArgTypes []uint32
RetType uint32
RetSet bool
Volatile byte
Parallel byte
IsStrict bool
SecDef bool
LeakProof bool
Language string
Body string
}
UserProc represents a user-defined function or procedure.
type VarExpr ¶
type VarExpr struct {
RangeIdx int // index into Query.RangeTable (0-based)
AttNum int16 // column number (1-based)
TypeOID uint32 // result type
TypeMod int32 // type modifier
Collation uint32 // collation OID
LevelsUp int // 0 = current query, 1 = parent, etc. (for correlated subqueries)
}
VarExpr represents a resolved column reference.
pg: src/include/nodes/primnodes.h — Var
type Warning ¶
Warning represents a non-fatal notice emitted during DDL processing, analogous to PostgreSQL's NOTICE/WARNING messages.
type WindowClauseQ ¶
type WindowClauseQ struct {
Name string // window name (empty if inline OVER)
PartitionBy []*SortGroupClause // PARTITION BY
OrderBy []*SortGroupClause // ORDER BY
FrameOptions int // bitmask
StartOffset AnalyzedExpr // frame start expression
EndOffset AnalyzedExpr // frame end expression
}
WindowClauseQ represents an analyzed WINDOW clause entry.
pg: src/include/nodes/parsenodes.h — WindowClause
type WindowFuncExpr ¶
type WindowFuncExpr struct {
FuncOID uint32
FuncName string
ResultType uint32
Collation uint32 // result collation
Args []AnalyzedExpr
AggStar bool // e.g. count(*)
AggFilter AnalyzedExpr // FILTER (WHERE ...), may be nil
WinRef uint32 // index into Query.WindowClause
}
WindowFuncExpr represents a window function call.
pg: src/include/nodes/primnodes.h — WindowFunc
Source Files
¶
- aclchk.go
- aggregatecmds.go
- alias.go
- alter.go
- analyze.go
- catalog.go
- clone.go
- coerce.go
- comment.go
- constraint.go
- createas.go
- depend.go
- dropcmds.go
- errors.go
- exec.go
- functioncmds.go
- indexcmds.go
- nodeutil.go
- oid.go
- oids_generated.go
- operatorcmds.go
- pg_cast_generated.go
- pg_operator_generated.go
- pg_proc_generated.go
- pg_type_generated.go
- policy.go
- query.go
- relation.go
- resolve.go
- ruleutils.go
- schema.go
- schemacmds.go
- sequence.go
- syscache.go
- tablecmds.go
- trigger.go
- typecmds.go
- types.go
- utility.go
- view.go