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-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 pavel.steh...@gmail.com 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 --

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

2014-10-23 Thread Florian Pflug
On Oct23, 2014, at 15:39 , Andrew Dunstan and...@dunslane.net wrote: On 10/23/2014 09:27 AM, Merlin Moncure wrote: On Thu, Oct 23, 2014 at 4:34 AM, Pavel Stehule pavel.steh...@gmail.com 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:57 AM, Florian Pflug wrote: On Oct23, 2014, at 15:39 , Andrew Dunstan and...@dunslane.net wrote: On 10/23/2014 09:27 AM, Merlin Moncure wrote: On Thu, Oct 23, 2014 at 4:34 AM, Pavel Stehule pavel.steh...@gmail.com wrote: postgres=# select row_to_json(row(10 as A, row(30 as

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 lt; andrew@ gt; wrote: On 10/23/2014 09:27 AM, Merlin Moncure wrote: On Thu, Oct 23, 2014 at 4:34 AM, Pavel Stehule lt; pavel.stehule@ gt; wrote: postgres=# select

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 david.g.johns...@gmail.com: Andrew Dunstan wrote On 10/23/2014 09:57 AM, Florian Pflug wrote: On Oct23, 2014, at 15:39 , Andrew Dunstan lt; andrew@ gt; wrote: On 10/23/2014 09:27 AM, Merlin Moncure wrote: On Thu, Oct 23, 2014 at 4:34 AM,

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 lt; andrew@ gt; wrote: On 10/23/2014 09:27 AM, Merlin Moncure wrote: On Thu, Oct 23, 2014 at 4:34 AM, Pavel Stehule lt;

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 and...@dunslane.net 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 lt; andrew@ gt; wrote: On 10/23/2014 09:27 AM, Merlin

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 and...@dunslane.net wrote: On 10/23/2014 09:27 AM, Merlin Moncure wrote: On Thu, Oct 23, 2014 at 4:34 AM, Pavel Stehule pavel.steh...@gmail.com wrote: Hi here is a prototype postgres=# select row_to_json(row(10 as A, row(30 as c, 20 AS B)

[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

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 pavel.steh...@gmail.com: Hi with

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 pavel.steh...@gmail.com 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

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 mmonc...@gmail.com: On Wed, Oct 22, 2014 at 11:21 AM, Pavel Stehule pavel.steh...@gmail.com 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