pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Can't read oprcode from remote pg_operator
3+ messages / 2 participants
[nested] [flat]

* Can't read oprcode from remote pg_operator
@ 2017-09-05 11:15 Thom Brown <thom@linux.com>
  2017-09-05 11:57 ` Re: Can't read oprcode from remote pg_operator Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Thom Brown @ 2017-09-05 11:15 UTC (permalink / raw)
  To: pgsql-bugs

It seems that, if you have a foreign table pointing to pg_operator in
another cluster, you cannot return the oprcode column for certain
rows.  I'm getting this on 10 beta 3.

I have imported pg_operator using IMPORT FOREIGN SCHEMA, and I get the
following errors:

# SELECT * FROM pg.pg_operator ORDER BY oprname DESC, oprleft,
oprright LIMIT 701;
ERROR:  more than one function named "pg_catalog.tsquery_phrase"
CONTEXT:  column "oprcode" of foreign table "pg_operator"


# SELECT * FROM pg.pg_operator ORDER BY oprname, oprleft, oprright LIMIT 701;
ERROR:  more than one function named "pg_catalog.jsonb_delete"
CONTEXT:  column "oprcode" of foreign table "pg_operator"

This seems like a bug, although I suspect this may be explainable as
expected and wanted behaviour.

Regards

Thom


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Can't read oprcode from remote pg_operator
  2017-09-05 11:15 Can't read oprcode from remote pg_operator Thom Brown <thom@linux.com>
@ 2017-09-05 11:57 ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-09-05 12:25   ` Re: Can't read oprcode from remote pg_operator Thom Brown <thom@linux.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2017-09-05 11:57 UTC (permalink / raw)
  To: Thom Brown <thom@linux.com>; +Cc: pgsql-bugs

Thom Brown <thom@linux.com> writes:
> It seems that, if you have a foreign table pointing to pg_operator in
> another cluster, you cannot return the oprcode column for certain
> rows.  I'm getting this on 10 beta 3.

I don't think that has anything to do with remoteness or not, nor which
PG version you try.  The regproc representation is inherently ambiguous,
so even locally you will get:

regression=# select oprcode::text::regproc from pg_operator;
ERROR:  more than one function named "pg_catalog.tsquery_phrase"

Likewise for, eg, pg_aggregate.aggfnoid.

> I have imported pg_operator using IMPORT FOREIGN SCHEMA,

If that seemed like a widely useful thing to do, I might be more
worried.  But if you want to do this, I'd suggest making a view
over pg_operator that casts the regproc columns to regprocedure,
and then importing that.  Even then, it will fail if the remote
catalog contains references to any functions that don't exist
locally.

We've talked in the past about deprecating regproc/regoper and
converting those columns to the fully qualified types; that
would help the ambiguity part of your issue, though not the
nonexistence part.  But that's blocked on teaching genbki.pl
to do the equivalent of regprocedurein and fill those columns
with numeric OIDs in the BKI file.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Can't read oprcode from remote pg_operator
  2017-09-05 11:15 Can't read oprcode from remote pg_operator Thom Brown <thom@linux.com>
  2017-09-05 11:57 ` Re: Can't read oprcode from remote pg_operator Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-09-05 12:25   ` Thom Brown <thom@linux.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Thom Brown @ 2017-09-05 12:25 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs

On 5 September 2017 at 12:57, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Thom Brown <thom@linux.com> writes:
>> It seems that, if you have a foreign table pointing to pg_operator in
>> another cluster, you cannot return the oprcode column for certain
>> rows.  I'm getting this on 10 beta 3.
>
> I don't think that has anything to do with remoteness or not, nor which
> PG version you try.  The regproc representation is inherently ambiguous,
> so even locally you will get:
>
> regression=# select oprcode::text::regproc from pg_operator;
> ERROR:  more than one function named "pg_catalog.tsquery_phrase"
>
> Likewise for, eg, pg_aggregate.aggfnoid.

I guess it was only revealed by my accessing the table remotely.  A
plain select locally works, but a plain select remotely, doesn't.

>> I have imported pg_operator using IMPORT FOREIGN SCHEMA,
>
> If that seemed like a widely useful thing to do, I might be more
> worried.  But if you want to do this, I'd suggest making a view
> over pg_operator that casts the regproc columns to regprocedure,
> and then importing that.  Even then, it will fail if the remote
> catalog contains references to any functions that don't exist
> locally.

Yeah, I think I'll make a view in my case.  Thanks.

> We've talked in the past about deprecating regproc/regoper and
> converting those columns to the fully qualified types; that
> would help the ambiguity part of your issue, though not the
> nonexistence part.  But that's blocked on teaching genbki.pl
> to do the equivalent of regprocedurein and fill those columns
> with numeric OIDs in the BKI file.

Thom


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2017-09-05 12:25 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-09-05 11:15 Can't read oprcode from remote pg_operator Thom Brown <thom@linux.com>
2017-09-05 11:57 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-09-05 12:25   ` Thom Brown <thom@linux.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox