From 35908df25f9079a73270eefb1cf4c3df635ee876 Mon Sep 17 00:00:00 2001 From: Dmitriy Garanzha Date: Mon, 2 Sep 2019 16:57:21 +0300 Subject: [PATCH] Filter automatically created table array types. --- conn.go | 2 ++ pgmock/pgmock.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/conn.go b/conn.go index 9dc4cdbf..b98434f7 100644 --- a/conn.go +++ b/conn.go @@ -611,12 +611,14 @@ func initPostgresql(c *Conn) (*pgtype.ConnInfo, error) { end from pg_type t left join pg_type base_type on t.typelem=base_type.oid +left join pg_class base_cls ON base_type.typrelid = base_cls.oid left join pg_namespace nsp on t.typnamespace=nsp.oid left join pg_class cls on t.typrelid=cls.oid where ( t.typtype in('b', 'p', 'r', 'e', 'c') and (base_type.oid is null or base_type.typtype in('b', 'p', 'r', 'c')) and (cls.oid is null or cls.relkind='c') + and (base_cls.oid is null or base_cls.relkind = 'c') )` ) diff --git a/pgmock/pgmock.go b/pgmock/pgmock.go index 5c3fdc27..7b9e7991 100644 --- a/pgmock/pgmock.go +++ b/pgmock/pgmock.go @@ -210,12 +210,14 @@ func PgxInitSteps() []Step { end from pg_type t left join pg_type base_type on t.typelem=base_type.oid +left join pg_class base_cls ON base_type.typrelid = base_cls.oid left join pg_namespace nsp on t.typnamespace=nsp.oid left join pg_class cls on t.typrelid=cls.oid where ( t.typtype in('b', 'p', 'r', 'e', 'c') and (base_type.oid is null or base_type.typtype in('b', 'p', 'r', 'c')) and (cls.oid is null or cls.relkind='c') + and (base_cls.oid is null or base_cls.relkind = 'c') )`, }), ExpectMessage(&pgproto3.Describe{