Re: BUG #15998: query to return a table column list gives error on amissing foreign data wrapper library
От | Etsuro Fujita |
---|---|
Тема | Re: BUG #15998: query to return a table column list gives error on amissing foreign data wrapper library |
Дата | |
Msg-id | CAPmGK15Jx54cMyK2cjGs8mGiQwvDfqFgO7Nv5CnfZiYkf813iA@mail.gmail.com обсуждение исходный текст |
Ответ на | BUG #15998: query to return a table column list gives error on a missing foreign data wrapper library (PG Bug reporting form <noreply@postgresql.org>) |
Ответы |
Re: BUG #15998: query to return a table column list gives error on a missing foreign data wrapper library
|
Список | pgsql-bugs |
On Tue, Sep 10, 2019 at 6:46 PM PG Bug reporting form <noreply@postgresql.org> wrote: > Have been able to reproduce the behavior on postgres 10 and 11 with the > postgres_fdw on centos 7 on ppc64le. > Take a postgres database with foreign servers and foreign tables. > remove the fdw library. > i simulated this by > mv postgres_fdw.so postgres_fdw.so.xx > > run the query below on a normal table > the query needs to be adjusted to to have a table oid (version runs in > postgres 11) > SELECT > typ.oid AS typoid, nspname, relname, attname, attrelid, attnum, > attnotnull, > attidentity != '' AS isidentity, > CASE WHEN typ.typtype = 'd' THEN typ.typtypmod ELSE atttypmod > END AS typmod, > CASE WHEN atthasdef THEN (SELECT pg_get_expr(adbin, cls.oid) > FROM pg_attrdef WHERE adrelid = cls.oid AND adnum = attr.attnum) ELSE NULL > END AS default, > CASE WHEN col.is_updatable = 'YES' THEN true ELSE false END AS > is_updatable, > EXISTS ( > SELECT * FROM pg_index > WHERE pg_index.indrelid = cls.oid AND > pg_index.indisprimary AND > attnum = ANY (indkey) > ) AS isprimarykey, > EXISTS ( > SELECT * FROM pg_index > WHERE pg_index.indrelid = cls.oid AND > pg_index.indisunique AND > pg_index.indnkeyatts = 1 AND > attnum = pg_index.indkey[0] > ) AS isunique > FROM pg_attribute AS attr > JOIN pg_type AS typ ON attr.atttypid = typ.oid > JOIN pg_class AS cls ON cls.oid = attr.attrelid > JOIN pg_namespace AS ns ON ns.oid = cls.relnamespace > LEFT OUTER JOIN information_schema.columns AS col ON > col.table_schema = nspname AND > col.table_name = relname AND > col.column_name = attname > WHERE > atttypid <> 0 AND > relkind IN ('r', 'v', 'm') AND > NOT attisdropped AND > nspname NOT IN ('pg_catalog', 'information_schema') AND > attnum > 0 AND > ((attr.attrelid=1354075 AND attr.attnum=1)) > ORDER BY attnum > > throws error > ERROR: could not access file "$libdir/postgres_fdw": No such file or > directory I'm now traveling, so I cannot try to reproduce this. Could you send the EXPLAIN output for this query? > commenting out the case statement > CASE WHEN col.is_updatable = 'YES' THEN true ELSE false END AS > is_updatable, > > causes the query to run without error. Seems reasonable to me; the is_updatable reference would cause the IsForeignRelUpdatable() call for postgres_fdw foreign tables IIUC, so removing that would be a workaround for this issue if that works for you. Best regards, Etsuro Fujita
В списке pgsql-bugs по дате отправления: