diff --git a/pgtt.c b/pgtt.c index 0dcf500..625dc0a 100755 --- a/pgtt.c +++ b/pgtt.c @@ -897,8 +897,14 @@ gtt_check_command(GTT_PROCESSUTILITY_PROTO) Oid relid; char *nspname; - relid = RangeVarGetRelidExtended(stmt->relation, ShareLock, 0, - RangeVarCallbackOwnsRelation, NULL); + relid = RangeVarGetRelidExtended(stmt->relation, ShareLock, +#if (PG_VERSION_NUM >= 110000) + 0, +#else + false, false, +#endif + RangeVarCallbackOwnsRelation, + NULL); /* Just take care that the GTT is not in use */ nspname = get_namespace_name(get_rel_namespace(relid)); @@ -1530,7 +1536,7 @@ create_temporary_table_internal(Oid parent_relid, bool preserved) { CommentObject((CommentStmt *) cur_stmt); } -#if (PG_VERSION_NUM >= 100000) +#if (PG_VERSION_NUM >= 90600) else if (IsA(cur_stmt, TableLikeClause)) { TableLikeClause *like = (TableLikeClause *) cur_stmt; @@ -1563,7 +1569,7 @@ create_temporary_table_internal(Oid parent_relid, bool preserved) NULL, NULL, None_Receiver, NULL); -#elif PG_VERSION_NUM >= 90500 +#else ProcessUtility(cur_stmt, "PGTT provide a query string", PROCESS_UTILITY_SUBCOMMAND, diff --git a/test/expected/05_useindex.out b/test/expected/05_useindex.out index 35a53d8..d70f087 100644 --- a/test/expected/05_useindex.out +++ b/test/expected/05_useindex.out @@ -98,14 +98,15 @@ SELECT * FROM t_glob_temptable2; -- Must complain that the GTT is in use CREATE INDEX ON t_glob_temptable2 (lbl); ERROR: a temporary table has been created and is active, can not add an index on the GTT table in this session. -\d pgtt_schema.t_glob_temptable2 - Unlogged table "pgtt_schema.t_glob_temptable2" - Column | Type | Collation | Nullable | Default ---------+---------+-----------+----------+--------- - id | integer | | | - lbl | text | | | -Indexes: - "t_glob_temptable2_id_idx" btree (id) +SELECT pg_catalog.pg_get_indexdef(i.indexrelid, 0, true) +FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i +LEFT JOIN pg_catalog.pg_constraint con ON (conrelid = i.indrelid AND conindid = i.indexrelid AND contype IN ('p','u','x')) +WHERE c.oid = 'pgtt_schema.t_glob_temptable2'::regclass::oid AND c.oid = i.indrelid AND i.indexrelid = c2.oid +ORDER BY i.indisprimary DESC, c2.relname; + pg_get_indexdef +----------------------------------------------------------------------------------------- + CREATE INDEX t_glob_temptable2_id_idx ON pgtt_schema.t_glob_temptable2 USING btree (id) +(1 row) \c - - LOAD 'pgtt'; diff --git a/test/sql/05_useindex.sql b/test/sql/05_useindex.sql index 2ee0bed..de33a9b 100644 --- a/test/sql/05_useindex.sql +++ b/test/sql/05_useindex.sql @@ -75,7 +75,11 @@ SELECT * FROM t_glob_temptable2; -- Must complain that the GTT is in use CREATE INDEX ON t_glob_temptable2 (lbl); -\d pgtt_schema.t_glob_temptable2 +SELECT pg_catalog.pg_get_indexdef(i.indexrelid, 0, true) +FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i +LEFT JOIN pg_catalog.pg_constraint con ON (conrelid = i.indrelid AND conindid = i.indexrelid AND contype IN ('p','u','x')) +WHERE c.oid = 'pgtt_schema.t_glob_temptable2'::regclass::oid AND c.oid = i.indrelid AND i.indexrelid = c2.oid +ORDER BY i.indisprimary DESC, c2.relname; \c - - LOAD 'pgtt';