Module: PgQuery

Defined in:
lib/pg_query/node.rb,
lib/pg_query/scan.rb,
lib/pg_query/parse.rb,
lib/pg_query/deparse.rb,
lib/pg_query/version.rb,
lib/pg_query/truncate.rb,
lib/pg_query/constants.rb,
lib/pg_query/param_refs.rb,
lib/pg_query/treewalker.rb,
lib/pg_query/fingerprint.rb,
lib/pg_query/parse_error.rb,
lib/pg_query/pg_query_pb.rb,
lib/pg_query/filter_columns.rb

Defined Under Namespace

Classes: Node, ParseError, ParserResult, ScanError

Constant Summary collapse

VERSION =
'6.0.0'.freeze
LOCK_MODE_NO_LOCK =

From Postgres source: src/include/storage/lockdefs.h

0
LOCK_MODE_ACCESS_SHARE_LOCK =

NoLock is not a lock mode, but a flag value meaning “don’t get a lock”

1
LOCK_MODE_ROW_SHARE_LOCK =

SELECT

2
LOCK_MODE_ROW_EXCLUSIVE_LOCK =

SELECT FOR UPDATE/FOR SHARE

3
LOCK_MODE_SHARE_UPDATE_EXCLUSIVE_LOCK =

INSERT, UPDATE, DELETE

4
LOCK_MODE_SHARE_LOCK =

VACUUM (non-FULL),ANALYZE, CREATE INDEX CONCURRENTLY

5
LOCK_MODE_SHARE_ROW_EXCLUSIVE_LOCK =

CREATE INDEX (WITHOUT CONCURRENTLY)

6
LOCK_MODE_EXCLUSIVE_LOCK =

like EXCLUSIVE MODE, but allows ROW SHARE

7
LOCK_MODE_ACCESS_EXCLUSIVE_LOCK =

blocks ROW SHARE/SELECT…FOR UPDATE

8
TRIGGER_TYPE_ROW =

From Postgres source: src/include/catalog/pg_trigger.h

(1 << 0)
TRIGGER_TYPE_BEFORE =
(1 << 1)
TRIGGER_TYPE_INSERT =
(1 << 2)
TRIGGER_TYPE_DELETE =
(1 << 3)
TRIGGER_TYPE_UPDATE =
(1 << 4)
TRIGGER_TYPE_TRUNCATE =
(1 << 5)
TRIGGER_TYPE_INSTEAD =
(1 << 6)
ParseResult =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ParseResult").msgclass
ScanResult =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ScanResult").msgclass
Integer =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.Integer").msgclass
Float =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.Float").msgclass
Boolean =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.Boolean").msgclass
String =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.String").msgclass
BitString =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.BitString").msgclass
List =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.List").msgclass
OidList =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.OidList").msgclass
IntList =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.IntList").msgclass
A_Const =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.A_Const").msgclass
Alias =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.Alias").msgclass
RangeVar =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RangeVar").msgclass
TableFunc =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.TableFunc").msgclass
IntoClause =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.IntoClause").msgclass
Var =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.Var").msgclass
Param =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.Param").msgclass
Aggref =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.Aggref").msgclass
GroupingFunc =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.GroupingFunc").msgclass
WindowFunc =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.WindowFunc").msgclass
WindowFuncRunCondition =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.WindowFuncRunCondition").msgclass
MergeSupportFunc =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.MergeSupportFunc").msgclass
SubscriptingRef =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SubscriptingRef").msgclass
FuncExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.FuncExpr").msgclass
NamedArgExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.NamedArgExpr").msgclass
OpExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.OpExpr").msgclass
DistinctExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.DistinctExpr").msgclass
NullIfExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.NullIfExpr").msgclass
ScalarArrayOpExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ScalarArrayOpExpr").msgclass
BoolExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.BoolExpr").msgclass
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SubLink").msgclass
SubPlan =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SubPlan").msgclass
AlternativeSubPlan =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlternativeSubPlan").msgclass
FieldSelect =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.FieldSelect").msgclass
FieldStore =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.FieldStore").msgclass
RelabelType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RelabelType").msgclass
CoerceViaIO =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CoerceViaIO").msgclass
ArrayCoerceExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ArrayCoerceExpr").msgclass
ConvertRowtypeExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ConvertRowtypeExpr").msgclass
CollateExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CollateExpr").msgclass
CaseExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CaseExpr").msgclass
CaseWhen =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CaseWhen").msgclass
CaseTestExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CaseTestExpr").msgclass
ArrayExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ArrayExpr").msgclass
RowExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RowExpr").msgclass
RowCompareExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RowCompareExpr").msgclass
CoalesceExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CoalesceExpr").msgclass
MinMaxExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.MinMaxExpr").msgclass
SQLValueFunction =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SQLValueFunction").msgclass
XmlExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.XmlExpr").msgclass
JsonFormat =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonFormat").msgclass
JsonReturning =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonReturning").msgclass
JsonValueExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonValueExpr").msgclass
JsonConstructorExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonConstructorExpr").msgclass
JsonIsPredicate =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonIsPredicate").msgclass
JsonBehavior =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonBehavior").msgclass
JsonExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonExpr").msgclass
JsonTablePath =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonTablePath").msgclass
JsonTablePathScan =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonTablePathScan").msgclass
JsonTableSiblingJoin =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonTableSiblingJoin").msgclass
NullTest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.NullTest").msgclass
BooleanTest =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.BooleanTest").msgclass
MergeAction =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.MergeAction").msgclass
CoerceToDomain =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CoerceToDomain").msgclass
CoerceToDomainValue =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CoerceToDomainValue").msgclass
SetToDefault =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SetToDefault").msgclass
CurrentOfExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CurrentOfExpr").msgclass
NextValueExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.NextValueExpr").msgclass
InferenceElem =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.InferenceElem").msgclass
TargetEntry =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.TargetEntry").msgclass
RangeTblRef =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RangeTblRef").msgclass
JoinExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JoinExpr").msgclass
FromExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.FromExpr").msgclass
OnConflictExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.OnConflictExpr").msgclass
Query =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.Query").msgclass
TypeName =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.TypeName").msgclass
ColumnRef =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ColumnRef").msgclass
ParamRef =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ParamRef").msgclass
A_Expr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.A_Expr").msgclass
TypeCast =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.TypeCast").msgclass
CollateClause =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CollateClause").msgclass
RoleSpec =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RoleSpec").msgclass
FuncCall =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.FuncCall").msgclass
A_Star =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.A_Star").msgclass
A_Indices =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.A_Indices").msgclass
A_Indirection =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.A_Indirection").msgclass
A_ArrayExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.A_ArrayExpr").msgclass
ResTarget =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ResTarget").msgclass
MultiAssignRef =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.MultiAssignRef").msgclass
SortBy =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SortBy").msgclass
WindowDef =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.WindowDef").msgclass
RangeSubselect =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RangeSubselect").msgclass
RangeFunction =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RangeFunction").msgclass
RangeTableFunc =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RangeTableFunc").msgclass
RangeTableFuncCol =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RangeTableFuncCol").msgclass
RangeTableSample =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RangeTableSample").msgclass
ColumnDef =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ColumnDef").msgclass
TableLikeClause =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.TableLikeClause").msgclass
IndexElem =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.IndexElem").msgclass
DefElem =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.DefElem").msgclass
LockingClause =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.LockingClause").msgclass
XmlSerialize =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.XmlSerialize").msgclass
PartitionElem =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.PartitionElem").msgclass
PartitionSpec =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.PartitionSpec").msgclass
PartitionBoundSpec =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.PartitionBoundSpec").msgclass
PartitionRangeDatum =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.PartitionRangeDatum").msgclass
SinglePartitionSpec =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SinglePartitionSpec").msgclass
PartitionCmd =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.PartitionCmd").msgclass
RangeTblEntry =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RangeTblEntry").msgclass
RTEPermissionInfo =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RTEPermissionInfo").msgclass
RangeTblFunction =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RangeTblFunction").msgclass
TableSampleClause =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.TableSampleClause").msgclass
WithCheckOption =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.WithCheckOption").msgclass
SortGroupClause =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SortGroupClause").msgclass
GroupingSet =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.GroupingSet").msgclass
WindowClause =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.WindowClause").msgclass
RowMarkClause =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RowMarkClause").msgclass
WithClause =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.WithClause").msgclass
InferClause =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.InferClause").msgclass
OnConflictClause =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.OnConflictClause").msgclass
CTESearchClause =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CTESearchClause").msgclass
CTECycleClause =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CTECycleClause").msgclass
CommonTableExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CommonTableExpr").msgclass
MergeWhenClause =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.MergeWhenClause").msgclass
TriggerTransition =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.TriggerTransition").msgclass
JsonOutput =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonOutput").msgclass
JsonArgument =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonArgument").msgclass
JsonFuncExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonFuncExpr").msgclass
JsonTablePathSpec =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonTablePathSpec").msgclass
JsonTable =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonTable").msgclass
JsonTableColumn =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonTableColumn").msgclass
JsonKeyValue =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonKeyValue").msgclass
JsonParseExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonParseExpr").msgclass
JsonScalarExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonScalarExpr").msgclass
JsonSerializeExpr =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonSerializeExpr").msgclass
JsonObjectConstructor =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonObjectConstructor").msgclass
JsonArrayConstructor =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonArrayConstructor").msgclass
JsonArrayQueryConstructor =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonArrayQueryConstructor").msgclass
JsonAggConstructor =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonAggConstructor").msgclass
JsonObjectAgg =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonObjectAgg").msgclass
JsonArrayAgg =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonArrayAgg").msgclass
RawStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RawStmt").msgclass
InsertStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.InsertStmt").msgclass
DeleteStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.DeleteStmt").msgclass
UpdateStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.UpdateStmt").msgclass
MergeStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.MergeStmt").msgclass
SelectStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SelectStmt").msgclass
SetOperationStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SetOperationStmt").msgclass
ReturnStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ReturnStmt").msgclass
PLAssignStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.PLAssignStmt").msgclass
CreateSchemaStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateSchemaStmt").msgclass
AlterTableStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterTableStmt").msgclass
ReplicaIdentityStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ReplicaIdentityStmt").msgclass
AlterTableCmd =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterTableCmd").msgclass
AlterCollationStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterCollationStmt").msgclass
AlterDomainStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterDomainStmt").msgclass
GrantStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.GrantStmt").msgclass
ObjectWithArgs =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ObjectWithArgs").msgclass
AccessPriv =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AccessPriv").msgclass
GrantRoleStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.GrantRoleStmt").msgclass
AlterDefaultPrivilegesStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterDefaultPrivilegesStmt").msgclass
CopyStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CopyStmt").msgclass
VariableSetStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.VariableSetStmt").msgclass
VariableShowStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.VariableShowStmt").msgclass
CreateStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateStmt").msgclass
Constraint =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.Constraint").msgclass
CreateTableSpaceStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateTableSpaceStmt").msgclass
DropTableSpaceStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.DropTableSpaceStmt").msgclass
AlterTableSpaceOptionsStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterTableSpaceOptionsStmt").msgclass
AlterTableMoveAllStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterTableMoveAllStmt").msgclass
CreateExtensionStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateExtensionStmt").msgclass
AlterExtensionStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterExtensionStmt").msgclass
AlterExtensionContentsStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterExtensionContentsStmt").msgclass
CreateFdwStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateFdwStmt").msgclass
AlterFdwStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterFdwStmt").msgclass
CreateForeignServerStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateForeignServerStmt").msgclass
AlterForeignServerStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterForeignServerStmt").msgclass
CreateForeignTableStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateForeignTableStmt").msgclass
CreateUserMappingStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateUserMappingStmt").msgclass
AlterUserMappingStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterUserMappingStmt").msgclass
DropUserMappingStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.DropUserMappingStmt").msgclass
ImportForeignSchemaStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ImportForeignSchemaStmt").msgclass
CreatePolicyStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreatePolicyStmt").msgclass
AlterPolicyStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterPolicyStmt").msgclass
CreateAmStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateAmStmt").msgclass
CreateTrigStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateTrigStmt").msgclass
CreateEventTrigStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateEventTrigStmt").msgclass
AlterEventTrigStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterEventTrigStmt").msgclass
CreatePLangStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreatePLangStmt").msgclass
CreateRoleStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateRoleStmt").msgclass
AlterRoleStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterRoleStmt").msgclass
AlterRoleSetStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterRoleSetStmt").msgclass
DropRoleStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.DropRoleStmt").msgclass
CreateSeqStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateSeqStmt").msgclass
AlterSeqStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterSeqStmt").msgclass
DefineStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.DefineStmt").msgclass
CreateDomainStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateDomainStmt").msgclass
CreateOpClassStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateOpClassStmt").msgclass
CreateOpClassItem =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateOpClassItem").msgclass
CreateOpFamilyStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateOpFamilyStmt").msgclass
AlterOpFamilyStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterOpFamilyStmt").msgclass
DropStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.DropStmt").msgclass
TruncateStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.TruncateStmt").msgclass
CommentStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CommentStmt").msgclass
SecLabelStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SecLabelStmt").msgclass
DeclareCursorStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.DeclareCursorStmt").msgclass
ClosePortalStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ClosePortalStmt").msgclass
FetchStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.FetchStmt").msgclass
IndexStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.IndexStmt").msgclass
CreateStatsStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateStatsStmt").msgclass
StatsElem =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.StatsElem").msgclass
AlterStatsStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterStatsStmt").msgclass
CreateFunctionStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateFunctionStmt").msgclass
FunctionParameter =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.FunctionParameter").msgclass
AlterFunctionStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterFunctionStmt").msgclass
DoStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.DoStmt").msgclass
InlineCodeBlock =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.InlineCodeBlock").msgclass
CallStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CallStmt").msgclass
CallContext =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CallContext").msgclass
RenameStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RenameStmt").msgclass
AlterObjectDependsStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterObjectDependsStmt").msgclass
AlterObjectSchemaStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterObjectSchemaStmt").msgclass
AlterOwnerStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterOwnerStmt").msgclass
AlterOperatorStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterOperatorStmt").msgclass
AlterTypeStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterTypeStmt").msgclass
RuleStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RuleStmt").msgclass
NotifyStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.NotifyStmt").msgclass
ListenStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ListenStmt").msgclass
UnlistenStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.UnlistenStmt").msgclass
TransactionStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.TransactionStmt").msgclass
CompositeTypeStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CompositeTypeStmt").msgclass
CreateEnumStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateEnumStmt").msgclass
CreateRangeStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateRangeStmt").msgclass
AlterEnumStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterEnumStmt").msgclass
ViewStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ViewStmt").msgclass
LoadStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.LoadStmt").msgclass
CreatedbStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreatedbStmt").msgclass
AlterDatabaseStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterDatabaseStmt").msgclass
AlterDatabaseRefreshCollStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterDatabaseRefreshCollStmt").msgclass
AlterDatabaseSetStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterDatabaseSetStmt").msgclass
DropdbStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.DropdbStmt").msgclass
AlterSystemStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterSystemStmt").msgclass
ClusterStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ClusterStmt").msgclass
VacuumStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.VacuumStmt").msgclass
VacuumRelation =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.VacuumRelation").msgclass
ExplainStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ExplainStmt").msgclass
CreateTableAsStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateTableAsStmt").msgclass
RefreshMatViewStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RefreshMatViewStmt").msgclass
CheckPointStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CheckPointStmt").msgclass
DiscardStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.DiscardStmt").msgclass
LockStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.LockStmt").msgclass
ConstraintsSetStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ConstraintsSetStmt").msgclass
ReindexStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ReindexStmt").msgclass
CreateConversionStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateConversionStmt").msgclass
CreateCastStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateCastStmt").msgclass
CreateTransformStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateTransformStmt").msgclass
PrepareStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.PrepareStmt").msgclass
ExecuteStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ExecuteStmt").msgclass
DeallocateStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.DeallocateStmt").msgclass
DropOwnedStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.DropOwnedStmt").msgclass
ReassignOwnedStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ReassignOwnedStmt").msgclass
AlterTSDictionaryStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterTSDictionaryStmt").msgclass
AlterTSConfigurationStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterTSConfigurationStmt").msgclass
PublicationTable =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.PublicationTable").msgclass
PublicationObjSpec =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.PublicationObjSpec").msgclass
CreatePublicationStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreatePublicationStmt").msgclass
AlterPublicationStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterPublicationStmt").msgclass
CreateSubscriptionStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CreateSubscriptionStmt").msgclass
AlterSubscriptionStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterSubscriptionStmt").msgclass
DropSubscriptionStmt =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.DropSubscriptionStmt").msgclass
ScanToken =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ScanToken").msgclass
QuerySource =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.QuerySource").enummodule
SortByDir =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SortByDir").enummodule
SortByNulls =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SortByNulls").enummodule
SetQuantifier =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SetQuantifier").enummodule
A_Expr_Kind =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.A_Expr_Kind").enummodule
RoleSpecType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RoleSpecType").enummodule
TableLikeOption =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.TableLikeOption").enummodule
DefElemAction =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.DefElemAction").enummodule
PartitionStrategy =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.PartitionStrategy").enummodule
PartitionRangeDatumKind =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.PartitionRangeDatumKind").enummodule
RTEKind =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RTEKind").enummodule
WCOKind =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.WCOKind").enummodule
GroupingSetKind =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.GroupingSetKind").enummodule
CTEMaterialize =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CTEMaterialize").enummodule
JsonQuotes =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonQuotes").enummodule
JsonTableColumnType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonTableColumnType").enummodule
SetOperation =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SetOperation").enummodule
ObjectType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ObjectType").enummodule
DropBehavior =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.DropBehavior").enummodule
AlterTableType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterTableType").enummodule
GrantTargetType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.GrantTargetType").enummodule
VariableSetKind =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.VariableSetKind").enummodule
ConstrType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ConstrType").enummodule
ImportForeignSchemaType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ImportForeignSchemaType").enummodule
RoleStmtType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RoleStmtType").enummodule
FetchDirection =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.FetchDirection").enummodule
FunctionParameterMode =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.FunctionParameterMode").enummodule
TransactionStmtKind =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.TransactionStmtKind").enummodule
ViewCheckOption =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ViewCheckOption").enummodule
DiscardMode =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.DiscardMode").enummodule
ReindexObjectType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ReindexObjectType").enummodule
AlterTSConfigType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterTSConfigType").enummodule
PublicationObjSpecType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.PublicationObjSpecType").enummodule
AlterPublicationAction =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterPublicationAction").enummodule
AlterSubscriptionType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AlterSubscriptionType").enummodule
OverridingKind =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.OverridingKind").enummodule
OnCommitAction =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.OnCommitAction").enummodule
TableFuncType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.TableFuncType").enummodule
ParamKind =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.ParamKind").enummodule
CoercionContext =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CoercionContext").enummodule
CoercionForm =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CoercionForm").enummodule
BoolExprType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.BoolExprType").enummodule
SubLinkType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SubLinkType").enummodule
RowCompareType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.RowCompareType").enummodule
MinMaxOp =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.MinMaxOp").enummodule
SQLValueFunctionOp =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SQLValueFunctionOp").enummodule
XmlExprOp =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.XmlExprOp").enummodule
XmlOptionType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.XmlOptionType").enummodule
JsonEncoding =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonEncoding").enummodule
JsonFormatType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonFormatType").enummodule
JsonConstructorType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonConstructorType").enummodule
JsonValueType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonValueType").enummodule
JsonWrapper =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonWrapper").enummodule
JsonBehaviorType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonBehaviorType").enummodule
JsonExprOp =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JsonExprOp").enummodule
NullTestType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.NullTestType").enummodule
BoolTestType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.BoolTestType").enummodule
MergeMatchKind =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.MergeMatchKind").enummodule
CmdType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.CmdType").enummodule
JoinType =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.JoinType").enummodule
AggStrategy =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AggStrategy").enummodule
AggSplit =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.AggSplit").enummodule
SetOpCmd =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SetOpCmd").enummodule
SetOpStrategy =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.SetOpStrategy").enummodule
OnConflictAction =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.OnConflictAction").enummodule
LimitOption =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.LimitOption").enummodule
LockClauseStrength =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.LockClauseStrength").enummodule
LockWaitPolicy =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.LockWaitPolicy").enummodule
LockTupleMode =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.LockTupleMode").enummodule
KeywordKind =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.KeywordKind").enummodule
Token =
::Google::Protobuf::DescriptorPool.generated_pool.lookup("pg_query.Token").enummodule
PG_VERSION =
rb_str_new2(PG_VERSION)
PG_MAJORVERSION =
rb_str_new2(PG_MAJORVERSION)
PG_VERSION_NUM =
INT2NUM(PG_VERSION_NUM)

Class Method Summary collapse

Class Method Details

._raw_scanObject



14
# File 'ext/pg_query/pg_query_ruby.c', line 14

VALUE pg_query_ruby_scan(VALUE self, VALUE input);

.deparse(tree) ⇒ Object

Reconstruct all of the parsed queries into their original form



9
10
11
12
13
14
15
16
17
# File 'lib/pg_query/deparse.rb', line 9

def self.deparse(tree)
  if PgQuery::ParseResult.method(:encode).arity == 1
    PgQuery.deparse_protobuf(PgQuery::ParseResult.encode(tree)).force_encoding('UTF-8')
  elsif PgQuery::ParseResult.method(:encode).arity == -1
    PgQuery.deparse_protobuf(PgQuery::ParseResult.encode(tree, recursion_limit: 1_000)).force_encoding('UTF-8')
  else
    raise ArgumentError, 'Unsupported protobuf Ruby API'
  end
end

.deparse_expr(expr) ⇒ Object

Convenience method for deparsing an expression



25
26
27
# File 'lib/pg_query/deparse.rb', line 25

def self.deparse_expr(expr)
  deparse_stmt(PgQuery::SelectStmt.new(where_clause: expr, op: :SETOP_NONE)).gsub('SELECT WHERE ', '')
end

.deparse_protobufObject



11
# File 'ext/pg_query/pg_query_ruby.c', line 11

VALUE pg_query_ruby_deparse_protobuf(VALUE self, VALUE input);

.deparse_stmt(stmt) ⇒ Object

Convenience method for deparsing a statement of a specific type



20
21
22
# File 'lib/pg_query/deparse.rb', line 20

def self.deparse_stmt(stmt)
  deparse(PgQuery::ParseResult.new(version: PG_VERSION_NUM, stmts: [PgQuery::RawStmt.new(stmt: PgQuery::Node.from(stmt))]))
end

.fingerprintObject



13
# File 'ext/pg_query/pg_query_ruby.c', line 13

VALUE pg_query_ruby_fingerprint(VALUE self, VALUE input);

.hash_xxh3_64Object



15
# File 'ext/pg_query/pg_query_ruby.c', line 15

VALUE pg_query_ruby_hash_xxh3_64(VALUE self, VALUE input, VALUE seed);

.normalizeObject



12
# File 'ext/pg_query/pg_query_ruby.c', line 12

VALUE pg_query_ruby_normalize(VALUE self, VALUE input);

.parse(query) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/pg_query/parse.rb', line 2

def self.parse(query)
  result, stderr = parse_protobuf(query)

  begin
    result = if PgQuery::ParseResult.method(:decode).arity == 1
               PgQuery::ParseResult.decode(result)
             elsif PgQuery::ParseResult.method(:decode).arity == -1
               PgQuery::ParseResult.decode(result, recursion_limit: 1_000)
             else
               raise ArgumentError, 'Unsupported protobuf Ruby API'
             end
  rescue Google::Protobuf::ParseError => e
    raise PgQuery::ParseError.new(format('Failed to parse tree: %s', e.message), __FILE__, __LINE__, -1)
  end

  warnings = []
  stderr.each_line do |line|
    next unless line[/^WARNING/]
    warnings << line.strip
  end

  PgQuery::ParserResult.new(query, result, warnings)
end

.parse_protobufObject



10
# File 'ext/pg_query/pg_query_ruby.c', line 10

VALUE pg_query_ruby_parse_protobuf(VALUE self, VALUE input);

.scan(query) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pg_query/scan.rb', line 10

def self.scan(query)
  out, stderr = _raw_scan(query)

  result = PgQuery::ScanResult.decode(out)

  warnings = []
  stderr.each_line do |line|
    next unless line[/^WARNING/]
    warnings << line.strip
  end

  [result, warnings]
end