lib/share/postspec_schema.sql in postspec-0.1.1 vs lib/share/postspec_schema.sql in postspec-0.1.2
- old
+ new
@@ -5,15 +5,18 @@
set search_path to postspec;
-- Return a map from table UID to last value of sequence. All user tables are
-- included but tables without sequences (subtables) have last value set to
-- null
-create or replace function table_sequence_ids() returns table(table_uid text, record_id bigint) as $$
+create or replace function table_sequence_ids(ignore_schemas varchar[])
+ returns table(table_uid text, record_id bigint)
+as $$
declare
name varchar(255);
tuple record;
begin
+ ignore_schemas := ignore_schemas || array['information_schema', 'postspec']::varchar[];
for tuple in
select tc.relnamespace::regnamespace::text || '.' || tc.relname as table_uid,
s.relnamespace::regnamespace::text || '.' || s.relname as sequence_uid
from pg_class tc
left join (
@@ -25,11 +28,11 @@
join pg_class sc on sc.oid = d.objid
where coalesce(sc.relkind = 'S', true)
and coalesce(sc.relnamespace::regnamespace::text != 'postspec', true)
) s on s.refobjid = tc.oid
where tc.relkind = 'r'
- and tc.relnamespace::regnamespace::text not like 'pg_%'
- and tc.relnamespace::regnamespace::text not in ('information_schema', 'postspec', 'prick')
+ and tc.relnamespace::regnamespace::text not like 'pg_%'
+ and tc.relnamespace::regnamespace::text != all(ignore_schemas)
loop
if tuple.sequence_uid is null then
table_uid := tuple.table_uid;
record_id := null;
return next;