Module: PgQuery::Deparse

Extended by:
Deparse
Included in:
Deparse
Defined in:
lib/pg_query/deparse.rb,
lib/pg_query/deparse/rename.rb,
lib/pg_query/deparse/interval.rb,
lib/pg_query/deparse/keywords.rb,
lib/pg_query/deparse/alter_table.rb

Overview

rubocop:disable Metrics/ModuleLength

Defined Under Namespace

Modules: AlterTable, Interval, Rename

Constant Summary collapse

KEYWORDS =

Keywords that need to be escaped during deparsing. This matches they keywords excaped by quote_identifier in Postgres ruleutils.c. You can refresh this list using the kwlist.h file (make sure to ignore UNRESERVED_KEYWORD entries)

%w[
  ALL
  ANALYSE
  ANALYZE
  AND
  ANY
  ARRAY
  AS
  ASC
  ASYMMETRIC
  AUTHORIZATION
  BETWEEN
  BIGINT
  BINARY
  BIT
  BOOLEAN
  BOTH
  CASE
  CAST
  CHAR
  CHARACTER
  CHECK
  COALESCE
  COLLATE
  COLLATION
  COLUMN
  CONCURRENTLY
  CONSTRAINT
  CREATE
  CROSS
  CURRENT_CATALOG
  CURRENT_DATE
  CURRENT_ROLE
  CURRENT_SCHEMA
  CURRENT_TIME
  CURRENT_TIMESTAMP
  CURRENT_USER
  DEC
  DECIMAL
  DEFAULT
  DEFERRABLE
  DESC
  DISTINCT
  DO
  ELSE
  END
  EXCEPT
  EXISTS
  EXTRACT
  FALSE
  FETCH
  FLOAT
  FOR
  FOREIGN
  FREEZE
  FROM
  FULL
  GRANT
  GREATEST
  GROUP
  GROUPING
  HAVING
  ILIKE
  IN
  INITIALLY
  INNER
  INOUT
  INT
  INTEGER
  INTERSECT
  INTERVAL
  INTO
  IS
  ISNULL
  JOIN
  LATERAL
  LEADING
  LEAST
  LEFT
  LIKE
  LIMIT
  LOCALTIME
  LOCALTIMESTAMP
  NATIONAL
  NATURAL
  NCHAR
  NONE
  NOT
  NOTNULL
  NULL
  NULLIF
  NUMERIC
  OFFSET
  ON
  ONLY
  OR
  ORDER
  OUT
  OUTER
  OVERLAPS
  OVERLAY
  PLACING
  POSITION
  PRECISION
  PRIMARY
  REAL
  REFERENCES
  RETURNING
  RIGHT
  ROW
  SELECT
  SESSION_USER
  SETOF
  SIMILAR
  SMALLINT
  SOME
  SUBSTRING
  SYMMETRIC
  TABLE
  TABLESAMPLE
  THEN
  TIME
  TIMESTAMP
  TO
  TRAILING
  TREAT
  TRIM
  TRUE
  UNION
  UNIQUE
  USER
  USING
  VALUES
  VARCHAR
  VARIADIC
  VERBOSE
  WHEN
  WHERE
  WINDOW
  WITH
  XMLATTRIBUTES
  XMLCONCAT
  XMLELEMENT
  XMLEXISTS
  XMLFOREST
  XMLNAMESPACES
  XMLPARSE
  XMLPI
  XMLROOT
  XMLSERIALIZE
  XMLTABLE
].freeze

Instance Method Summary collapse

Instance Method Details

#from(item) ⇒ Object

Given one element of the PgQuery#parsetree reconstruct it back into the original query.



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

def from(item)
  deparse_item(item)
end