Skip to content

Instantly share code, notes, and snippets.

@3manuek
Last active August 29, 2015 13:57
Show Gist options
  • Save 3manuek/9765751 to your computer and use it in GitHub Desktop.
Save 3manuek/9765751 to your computer and use it in GitHub Desktop.
deparse_util debug and analysis
-- COMMANDS
CREATE VIEW barf (a) AS SELECT * from foo;
CREATE RECURSIVE VIEW barf_recursive (a) AS SELECT a from foo;
CREATE VIEW rebarf_baz (d) AS (SELECT d from baz) WITH CASCADED CHECK OPTION;
CREATE VIEW rebarf_sb (d) WITH (security_barrier=0) AS SELECT d from baz;
CREATE VIEW rebarf (a) WITH (security_barrier) AS SELECT a from foo ;
CREATE VIEW rebarf_2 (a) AS SELECT a from foo WITH LOCAL CHECK OPTION;
CREATE VIEW barf_check AS SELECT * FROM nyan WITH CHECK OPTION;
-- MESSAGES
ERROR: operator does not exist: pg_catalog.oid = pg_catalog.oid
LINE 1: ...ELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND r...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
QUERY: SELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND rulename = $2
CONTEXT: PL/pgSQL function snitch() line 5 at FOR over SELECT rows
ERROR: operator does not exist: pg_catalog.oid = pg_catalog.oid
LINE 1: ...ELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND r...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
QUERY: SELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND rulename = $2
CONTEXT: PL/pgSQL function snitch() line 5 at FOR over SELECT rows
ERROR: operator does not exist: pg_catalog.oid = pg_catalog.oid
LINE 1: ...ELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND r...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
QUERY: SELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND rulename = $2
CONTEXT: PL/pgSQL function snitch() line 5 at FOR over SELECT rows
ERROR: operator does not exist: pg_catalog.oid = pg_catalog.oid
LINE 1: ...ELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND r...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
QUERY: SELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND rulename = $2
CONTEXT: PL/pgSQL function snitch() line 5 at FOR over SELECT rows
ERROR: operator does not exist: pg_catalog.oid = pg_catalog.oid
LINE 1: ...ELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND r...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
QUERY: SELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND rulename = $2
CONTEXT: PL/pgSQL function snitch() line 5 at FOR over SELECT rows
ERROR: operator does not exist: pg_catalog.oid = pg_catalog.oid
LINE 1: ...ELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND r...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
QUERY: SELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND rulename = $2
CONTEXT: PL/pgSQL function snitch() line 5 at FOR over SELECT rows
ERROR: operator does not exist: pg_catalog.oid = pg_catalog.oid
LINE 1: ...ELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND r...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
QUERY: SELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND rulename = $2
CONTEXT: PL/pgSQL function snitch() line 5 at FOR over SELECT rows
-------**_*_*_*__
-- ERROR
WARNING: column "col_24" has type "unknown"
WARNING: column "col_24" has type "unknown"
DETAIL: Proceeding with relation creation anyway.
CONTEXT: SQL statement "create table testalltypes (col_1 bool, col_2 bytea, col_3 "char", col_4 int8, col_5 int2, col_6 int4, col_7 regproc, col_8 text, col_9 oid, col_10 tid, col_11 xid, col_12 cid, col_13 json, col_14 xml, col_15 pg_node_tree, col_16 smgr, col_17 path, col_18 polygon, col_19 float4, col_20 float8, col_21 abstime, col_22 reltime, col_23 tinterval, col_24 unknown, col_25 circle, col_26 money, col_27 macaddr, col_28 inet, col_29 cidr, col_30 aclitem, col_31 bpchar, col_32 "varchar", col_33 date, col_34 "time", col_35 "timestamp", col_36 timestamptz, col_37 "interval", col_38 timetz, col_39 "bit", col_40 varbit, col_41 "numeric", col_42 refcursor, col_43 regprocedure, col_44 regoper, col_45 regoperator, col_46 regclass, col_47 regtype, col_48 uuid, col_49 pg_lsn, col_50 tsvector, col_51 gtsvector, col_52 tsquery, col_53 regconfig, col_54 regdictionary, col_55 txid_snapshot)"
PL/pgSQL function inline_code_block line 11 at EXECUTE statement
-- SENTENCE:
postgres=# CREATE TABLE weirdtypes (
postgres(# a integer,
postgres(# b int,
postgres(# c _int4,
postgres(# d int4[],
postgres(# d1 integer[],
postgres(# e integer[][],
postgres(# f timestamptz(6),
postgres(# g timestamp(2) with time zone,
postgres(# h timestamp(2) with time zone[],
postgres(# i _timestamptz(3),
postgres(# j time(4) with time zone,
postgres(# k timetz(3),
postgres(# l interval,
postgres(# m interval year to month,
postgres(# n interval day to second,
postgres(# o interval second,
postgres(# p numeric(10,4),
postgres(# q decimal(100,25),
postgres(# r "char",
postgres(# s char,
postgres(# t char(1),
postgres(# u _char,
postgres(# u1 _bpchar,
postgres(# v char[],
postgres(# w varchar,
postgres(# x varchar(10),
postgres(# y float(1),
postgres(# z float(8),
postgres(# aa float(15),
postgres(# ab float(32),
postgres(# ac float(53),
postgres(# ad float(53)[1]
postgres(# );
CREATE TABLE
postgres=#
postgres=# CREATE TABLE datatypes (
postgres(# int4_col int4,
postgres(# tstz_col timestamp with time zone,
postgres(# tsvector_col tsvector
postgres(# );
CREATE TABLE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment