Re: [HACKERS] idea: allow AS label inside ROW constructor

2014-10-23 Thread Merlin Moncure
On Thu, Oct 23, 2014 at 8:39 AM, Andrew Dunstan wrote: > > On 10/23/2014 09:27 AM, Merlin Moncure wrote: >> >> On Thu, Oct 23, 2014 at 4:34 AM, Pavel Stehule >> wrote: >>> >>> Hi >>> >>> here is a prototype >>> >>> postgres=# select row_to_json(row(10 as A, row(30 as c, 20 AS B) as x)); >>>

Re: [HACKERS] idea: allow AS label inside ROW constructor

2014-10-23 Thread David Johnston
On Thu, Oct 23, 2014 at 8:51 AM, Andrew Dunstan wrote: > > On 10/23/2014 11:36 AM, David G Johnston wrote: > >> Andrew Dunstan wrote >> >>> On 10/23/2014 09:57 AM, Florian Pflug wrote: >>> On Oct23, 2014, at 15:39 , Andrew Dunstan < >>> andrew@ >>> > wrote: >>> On 10/23/2014 09:27

Re: [HACKERS] idea: allow AS label inside ROW constructor

2014-10-23 Thread Andrew Dunstan
On 10/23/2014 11:36 AM, David G Johnston wrote: Andrew Dunstan wrote On 10/23/2014 09:57 AM, Florian Pflug wrote: On Oct23, 2014, at 15:39 , Andrew Dunstan < andrew@ > wrote: On 10/23/2014 09:27 AM, Merlin Moncure wrote: On Thu, Oct 23, 2014 at 4:34 AM, Pavel Stehule < pavel.stehule@ > wro

Re: [HACKERS] idea: allow AS label inside ROW constructor

2014-10-23 Thread Pavel Stehule
2014-10-23 17:36 GMT+02:00 David G Johnston : > Andrew Dunstan wrote > > On 10/23/2014 09:57 AM, Florian Pflug wrote: > >> On Oct23, 2014, at 15:39 , Andrew Dunstan < > > > andrew@ > > > > wrote: > >>> On 10/23/2014 09:27 AM, Merlin Moncure wrote: > On Thu, Oct 23, 2014 at 4:34 AM, Pavel Steh

Re: [HACKERS] idea: allow AS label inside ROW constructor

2014-10-23 Thread David G Johnston
Andrew Dunstan wrote > On 10/23/2014 09:57 AM, Florian Pflug wrote: >> On Oct23, 2014, at 15:39 , Andrew Dunstan < > andrew@ > > wrote: >>> On 10/23/2014 09:27 AM, Merlin Moncure wrote: On Thu, Oct 23, 2014 at 4:34 AM, Pavel Stehule < > pavel.stehule@ > > wrote: > postgres=# select row

Re: [HACKERS] idea: allow AS label inside ROW constructor

2014-10-23 Thread Andrew Dunstan
On 10/23/2014 09:57 AM, Florian Pflug wrote: On Oct23, 2014, at 15:39 , Andrew Dunstan wrote: On 10/23/2014 09:27 AM, Merlin Moncure wrote: On Thu, Oct 23, 2014 at 4:34 AM, Pavel Stehule wrote: postgres=# select row_to_json(row(10 as A, row(30 as c, 20 AS B) as x)); row_to_json --

Re: [HACKERS] idea: allow AS label inside ROW constructor

2014-10-23 Thread Florian Pflug
On Oct23, 2014, at 15:39 , Andrew Dunstan wrote: > On 10/23/2014 09:27 AM, Merlin Moncure wrote: >> On Thu, Oct 23, 2014 at 4:34 AM, Pavel Stehule >> wrote: >>> postgres=# select row_to_json(row(10 as A, row(30 as c, 20 AS B) as x)); >>> row_to_json >>> -- >>

Re: [HACKERS] idea: allow AS label inside ROW constructor

2014-10-23 Thread Andrew Dunstan
On 10/23/2014 09:27 AM, Merlin Moncure wrote: On Thu, Oct 23, 2014 at 4:34 AM, Pavel Stehule wrote: Hi here is a prototype postgres=# select row_to_json(row(10 as A, row(30 as c, 20 AS B) as x)); row_to_json -- {"a":10,"x":{"c":30,"b":20}} (1 row) pos

Re: [HACKERS] idea: allow AS label inside ROW constructor

2014-10-23 Thread Merlin Moncure
On Thu, Oct 23, 2014 at 4:34 AM, Pavel Stehule wrote: > Hi > > here is a prototype > > postgres=# select row_to_json(row(10 as A, row(30 as c, 20 AS B) as x)); > row_to_json > -- > {"a":10,"x":{"c":30,"b":20}} > (1 row) > > postgres=# select row_to_json(row(10

Re: [HACKERS] idea: allow AS label inside ROW constructor

2014-10-23 Thread Pavel Stehule
Hi here is a prototype postgres=# select row_to_json(row(10 as A, row(30 as c, 20 AS B) as x)); row_to_json -- {"a":10,"x":{"c":30,"b":20}} (1 row) postgres=# select row_to_json(row(10, row(30, 20))); row_to_json --

Re: [HACKERS] idea: allow AS label inside ROW constructor

2014-10-22 Thread Pavel Stehule
2014-10-22 18:35 GMT+02:00 Merlin Moncure : > On Wed, Oct 22, 2014 at 11:21 AM, Pavel Stehule > wrote: > > Hi > > > > with new functions row_to_json(b), there is more often usage of ROW > > constructor. Using names in fields is relative difficult. Because ROW has > > special clause in parser, I a

Re: [HACKERS] idea: allow AS label inside ROW constructor

2014-10-22 Thread Merlin Moncure
On Wed, Oct 22, 2014 at 11:21 AM, Pavel Stehule wrote: > Hi > > with new functions row_to_json(b), there is more often usage of ROW > constructor. Using names in fields is relative difficult. Because ROW has > special clause in parser, I am thinking so we can enable labeling inside ROW > construct

Re: [HACKERS] idea: allow AS label inside ROW constructor

2014-10-22 Thread Pavel Stehule
here is a motivation, why I propose this feature http://dba.stackexchange.com/questions/27732/set-names-to-attributes-when-creating-json-with-row-to-json same query I have in Czech postgres users mailing list Pavel 2014-10-22 18:21 GMT+02:00 Pavel Stehule : > Hi > > with new functions row_to_j

[HACKERS] idea: allow AS label inside ROW constructor

2014-10-22 Thread Pavel Stehule
Hi with new functions row_to_json(b), there is more often usage of ROW constructor. Using names in fields is relative difficult. Because ROW has special clause in parser, I am thinking so we can enable labeling inside ROW constructor so instead currently supported: select row_to_json(r) from (se