From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | Merlin Moncure <mmoncure(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Subject: | Re: dblink: add polymorphic functions. |
Date: | 2015-07-06 14:52:51 |
Message-ID: | 559A9643.9070409@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 07/06/2015 07:37 AM, Merlin Moncure wrote:
> yup, and at least one case now fails where previously it ran
> through: postgres=# select * from dblink('a', 'b', 'c'); ERROR:
> function dblink(unknown, unknown, unknown) is not unique
Hmm, that is an issue, possibly a fatal one.
When Cory first mentioned this to me over a year ago we discussed some
other, arguably better and more generic solutions. One was to build
support for:
SELECT * FROM srf() AS TYPE OF(foo);
The second idea I think is actually SQL standard if I recall correctly:
SELECT * FROM CAST(srf() AS foo) x;
Currently this works:
8<--------------------
select *
from cast (row(11,'l','{a11,b11,c11}') as foo);
f1 | f2 | f3
- ----+----+---------------
11 | l | {a11,b11,c11}
(1 row)
8<--------------------
But this fails:
8<--------------------
select *
from cast
(dblink('dbname=contrib_regression','select * from foo') as foo);
ERROR: cannot cast type record to foo
8<--------------------
Comments in the source have this to say:
8<--------------------
/*
* coerce_record_to_complex
* Coerce a RECORD to a specific composite type.
*
* Currently we only support this for inputs that are RowExprs or
* whole-row Vars.
*/
8<--------------------
That explains why the first example works while the second does not.
I'm not sure how hard it would be to fix that, but it appears that
that is where we should focus.
Joe
- --
Joe Conway
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAEBAgAGBQJVmpZDAAoJEDfy90M199hlIUsQAKcYeOXzzrlZjCeDSdIdx8YM
lAZ2kxjPwy5tLwm/WL1HwAM0epSBIMneF0JZuysFn77+bvbXId6LWtxkFKNakypP
tM5Ep0BjUFXgvzM3DVL0u9dkvrgcKlnwILsBjiWXqUVd/x8o2VAqfSOwfKG2SNQU
zo0l6u7ZeKY+gkFDsKU7eCo01dEI7MjGelKynRNE8TIpAJszNMsPpA4Y4WVRjbDT
GvA4O7f1Cws8Ewszle4gRWjx6TZ0mJVlt/FriFgtoRepoJjEalb5nfGLulx47Veq
iMFLbZr8xxc5u/ncR8bgi3Vc9g8H3eZsV6S85JeGuBS6cJOuw561gH5LkyEi5oeW
NHjZgf3oUnMZg1JE5cCGOyTQ/E/63itTor767f6KpaP/oEXckSCIUTh7azvD89sm
FD2udE3UWgC+16U11Ru+3TrRz11ETodF4TeW674CW3zA39dYjj3Us/PG6SDbM6zm
INO+pBvDIdhVaYvqy1yRqGMzgoQyCIAuI6sP+Q6CYqOd1Fdl42zPKGZ3F2SLEjq5
RfTKywrE1VHv1eafa6lCs5yaR7Jzr5FyRKFw9ob+TixN+x7vf6Gwcb9hkGzs9t2J
7NIiZ++U02fgVVVJGJ2VZ24gZVytP6sahq6Z6ccWacwic7lL7Us0mWgOKLzU1Umj
NLwHJoDkgV7SgGWVMsE/
=aRTA
-----END PGP SIGNATURE-----
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2015-07-06 15:01:44 | Re: ERROR: unexpected data beyond EOF |
Previous Message | Corey Huinker | 2015-07-06 14:49:02 | Re: dblink: add polymorphic functions. |