Re: dblink: add polymorphic functions.
От | Joe Conway |
---|---|
Тема | Re: dblink: add polymorphic functions. |
Дата | |
Msg-id | 559A9643.9070409@joeconway.com обсуждение исходный текст |
Ответ на | Re: dblink: add polymorphic functions. (Merlin Moncure <mmoncure@gmail.com>) |
Ответы |
Re: dblink: add polymorphic functions.
(Merlin Moncure <mmoncure@gmail.com>)
Re: dblink: add polymorphic functions. (Michael Paquier <michael.paquier@gmail.com>) |
Список | 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 inputsthat 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-----
В списке pgsql-hackers по дате отправления: