Re: [HACKERS] How hard would it be to support LIKE in return declaration of generic record function calls ?

2012-05-03 Thread Hannu Krosing
On Wed, 2012-05-02 at 14:32 -0500, Merlin Moncure wrote: On Wed, May 2, 2012 at 12:06 PM, Peter Eisentraut pete...@gmx.net wrote: On ons, 2012-05-02 at 13:40 +0200, Hannu Krosing wrote: How hard would it be to add support for LIKE syntax, similar to table def in field list declaration for

Re: [HACKERS] How hard would it be to support LIKE in return declaration of generic record function calls ?

2012-05-03 Thread Pavel Stehule
Hello (1 row) This works the same indeed, just seems to be a hack, though a cool one :) hannu=# insert into test hannu-# SELECT * FROM populate_record(null::test,                              'id=456, data=zzz'); INSERT 0 1 few years back I proposed anytypename type with this feature,

Re: [HACKERS] How hard would it be to support LIKE in return declaration of generic record function calls ?

2012-05-03 Thread Merlin Moncure
On Thu, May 3, 2012 at 7:13 AM, Pavel Stehule pavel.steh...@gmail.com wrote: Hello (1 row) This works the same indeed, just seems to be a hack, though a cool one :) Yeah -- the syntax isn't great, but IMO it's more generally usable than what you're proposing because it's a scalar returning

Re: [HACKERS] How hard would it be to support LIKE in return declaration of generic record function calls ?

2012-05-03 Thread Pavel Stehule
2012/5/3 Merlin Moncure mmonc...@gmail.com: On Thu, May 3, 2012 at 7:13 AM, Pavel Stehule pavel.steh...@gmail.com wrote: Hello (1 row) This works the same indeed, just seems to be a hack, though a cool one :) Yeah -- the syntax isn't great, but IMO it's more generally usable than what

Re: [HACKERS] How hard would it be to support LIKE in return declaration of generic record function calls ?

2012-05-03 Thread Andrew Dunstan
On 05/03/2012 09:43 AM, Pavel Stehule wrote: 2012/5/3 Merlin Moncuremmonc...@gmail.com: On Thu, May 3, 2012 at 7:13 AM, Pavel Stehulepavel.steh...@gmail.com wrote: Hello (1 row) This works the same indeed, just seems to be a hack, though a cool one :) Yeah -- the syntax isn't great, but

Re: [HACKERS] How hard would it be to support LIKE in return declaration of generic record function calls ?

2012-05-03 Thread Merlin Moncure
On Thu, May 3, 2012 at 9:01 AM, Andrew Dunstan and...@dunslane.net wrote: On 05/03/2012 09:43 AM, Pavel Stehule wrote: 2012/5/3 Merlin Moncuremmonc...@gmail.com: On Thu, May 3, 2012 at 7:13 AM, Pavel Stehulepavel.steh...@gmail.com  wrote: Hello (1 row) This works the same indeed, just

Re: [HACKERS] How hard would it be to support LIKE in return declaration of generic record function calls ?

2012-05-03 Thread Tom Lane
Andrew Dunstan and...@dunslane.net writes: You guys seem to be taking the original proposal off into the weeds. I have often wanted to be able to use LIKE in type expressions, and I'd like to see exactly that implemented. This notion of anytypename is utterly unworkable anyway; there's no

Re: [HACKERS] How hard would it be to support LIKE in return declaration of generic record function calls ?

2012-05-03 Thread Pavel Stehule
2012/5/3 Tom Lane t...@sss.pgh.pa.us: Andrew Dunstan and...@dunslane.net writes: You guys seem to be taking the original proposal off into the weeds. I have often wanted to be able to use LIKE in type expressions, and I'd like to see exactly that implemented. This notion of anytypename is

Re: [HACKERS] How hard would it be to support LIKE in return declaration of generic record function calls ?

2012-05-03 Thread Andrew Dunstan
On 05/03/2012 10:18 AM, Merlin Moncure wrote: On Thu, May 3, 2012 at 9:01 AM, Andrew Dunstanand...@dunslane.net wrote: On 05/03/2012 09:43 AM, Pavel Stehule wrote: 2012/5/3 Merlin Moncuremmonc...@gmail.com: On Thu, May 3, 2012 at 7:13 AM, Pavel Stehulepavel.steh...@gmail.com wrote:

Re: [HACKERS] How hard would it be to support LIKE in return declaration of generic record function calls ?

2012-05-03 Thread Tom Lane
Pavel Stehule pavel.steh...@gmail.com writes: 2012/5/3 Tom Lane t...@sss.pgh.pa.us: This notion of anytypename is utterly unworkable anyway; there's no way for the parser to know soon enough that a given argument position needs to be read as a type name rather than a normal expression. type

Re: [HACKERS] How hard would it be to support LIKE in return declaration of generic record function calls ?

2012-05-03 Thread Merlin Moncure
On Thu, May 3, 2012 at 9:44 AM, Andrew Dunstan and...@dunslane.net wrote: Why would you always need FROM? that was coming from Hannu's original example: insert into test2 select * from json_to_record(jrec json) as (like test2); how do you work it so you can call: select json_to_record(jrec

Re: [HACKERS] How hard would it be to support LIKE in return declaration of generic record function calls ?

2012-05-03 Thread Pavel Stehule
2012/5/3 Tom Lane t...@sss.pgh.pa.us: Pavel Stehule pavel.steh...@gmail.com writes: 2012/5/3 Tom Lane t...@sss.pgh.pa.us: This notion of anytypename is utterly unworkable anyway; there's no way for the parser to know soon enough that a given argument position needs to be read as a type name

Re: [HACKERS] How hard would it be to support LIKE in return declaration of generic record function calls ?

2012-05-03 Thread Tom Lane
Pavel Stehule pavel.steh...@gmail.com writes: 2012/5/3 Tom Lane t...@sss.pgh.pa.us: No, it isn't, at least not if you have any ambition to support array types for instance; to say nothing of types whose standard names are keywords, multiple words, etc. we can identify a position anytypename

Re: [HACKERS] How hard would it be to support LIKE in return declaration of generic record function calls ?

2012-05-03 Thread Merlin Moncure
On Thu, May 3, 2012 at 10:12 AM, Tom Lane t...@sss.pgh.pa.us wrote: Maybe some keyword can help to us. What do you think about new operator TYPE that can returns regtype value and can be used together with polymorphic functions. Doesn't have any more attraction for me than the proposed LIKE

Re: [HACKERS] How hard would it be to support LIKE in return declaration of generic record function calls ?

2012-05-02 Thread Peter Eisentraut
On ons, 2012-05-02 at 13:40 +0200, Hannu Krosing wrote: How hard would it be to add support for LIKE syntax, similar to table def in field list declaration for generic record functions What I'dd like to be able to do is to have a generic json_to_record function CREATE OR REPLACE RECORD

Re: [HACKERS] How hard would it be to support LIKE in return declaration of generic record function calls ?

2012-05-02 Thread Merlin Moncure
On Wed, May 2, 2012 at 12:06 PM, Peter Eisentraut pete...@gmx.net wrote: On ons, 2012-05-02 at 13:40 +0200, Hannu Krosing wrote: How hard would it be to add support for LIKE syntax, similar to table def in field list declaration for generic record functions What I'dd like to be able to do is