Re: Proposition for autoname columns

2020-11-12 Thread Eugen Konkov
> On 2020-Nov-12, Tom Lane wrote: >> On the whole, I'm on the side of the people who don't want to change this. >> The implementation cost seems likely to greatly outweigh the value, plus >> it feels more like a wart than a feature. > I think if Eugen wants to spend some time with it and see how

Re: Proposition for autoname columns

2020-11-12 Thread Bruce Momjian
On Thu, Nov 12, 2020 at 04:30:15PM -0300, Álvaro Herrera wrote: > On 2020-Nov-12, Tom Lane wrote: > > > On the whole, I'm on the side of the people who don't want to change this. > > The implementation cost seems likely to greatly outweigh the value, plus > > it feels more like a wart than a featu

Re: Proposition for autoname columns

2020-11-12 Thread Alvaro Herrera
On 2020-Nov-12, Tom Lane wrote: > On the whole, I'm on the side of the people who don't want to change this. > The implementation cost seems likely to greatly outweigh the value, plus > it feels more like a wart than a feature. I think if Eugen wants to spend some time with it and see how it coul

Re: Proposition for autoname columns

2020-11-12 Thread David G. Johnston
On Thursday, November 12, 2020, Bruce Momjian wrote: > On Thu, Nov 12, 2020 at 01:52:11PM -0500, Tom Lane wrote: > > On the whole, I'm on the side of the people who don't want to change > this. > > The implementation cost seems likely to greatly outweigh the value, plus > > it feels more like a w

Re: Proposition for autoname columns

2020-11-12 Thread Bruce Momjian
On Thu, Nov 12, 2020 at 01:52:11PM -0500, Tom Lane wrote: > On the whole, I'm on the side of the people who don't want to change this. > The implementation cost seems likely to greatly outweigh the value, plus > it feels more like a wart than a feature. I think we can mark this as, "We thought abo

Re: Proposition for autoname columns

2020-11-12 Thread Tom Lane
"David G. Johnston" writes: > The query rewriter would only rewrite these expressions and provide an > expression-related explicit alias clause if the expression is a single > operator (same as single function today) and the right-hand side of the > operator is a constant (meaning the constant is

Re: Proposition for autoname columns

2020-11-12 Thread David G. Johnston
On Thu, Nov 12, 2020 at 9:32 AM Andrew Dunstan wrote: > > On 11/12/20 11:12 AM, David G. Johnston wrote: > > On Thu, Nov 12, 2020 at 8:59 AM Andrew Dunstan > > wrote: > > > > > > > > So if we then say: > > > > > > select x, j->>x from mytable; > > > > > >

Re: Proposition for autoname columns

2020-11-12 Thread Bruce Momjian
On Thu, Nov 12, 2020 at 11:32:49AM -0500, Andrew Dunstan wrote: > On 11/12/20 11:12 AM, David G. Johnston wrote: > > IMO It no worse than today's: > > > > select count(*), count(*) from (values (1), (2)) vals (v); > > count | count > > 2 | 2 > > > > > I guess the difference here is that there's a

Re: Proposition for autoname columns

2020-11-12 Thread Andrew Dunstan
On 11/12/20 11:12 AM, David G. Johnston wrote: > On Thu, Nov 12, 2020 at 8:59 AM Andrew Dunstan > wrote: > > > > So if we then say: > > >     select x, j->>x from mytable; > > > you want both result columns named x? That seems like a recipe for > serio

Re: Proposition for autoname columns

2020-11-12 Thread David G. Johnston
On Thu, Nov 12, 2020 at 8:59 AM Andrew Dunstan wrote: > > > So if we then say: > > > select x, j->>x from mytable; > > > you want both result columns named x? That seems like a recipe for > serious confusion. I really don't think this proposal has been properly > thought through. > > IMO It n

Re: Proposition for autoname columns

2020-11-12 Thread Pavel Stehule
čt 12. 11. 2020 v 16:59 odesílatel Andrew Dunstan napsal: > > On 11/12/20 9:14 AM, Eugen Konkov wrote: > > Hello Andrew, > > > > Thursday, November 12, 2020, 3:19:39 PM, you wrote: > > > > > >> On 11/11/20 7:55 PM, Bruce Momjian wrote: > >>> On Thu, Nov 12, 2020 at 12:18:49AM +, Dagfinn Ilmar

Re: Proposition for autoname columns

2020-11-12 Thread Andrew Dunstan
On 11/12/20 9:14 AM, Eugen Konkov wrote: > Hello Andrew, > > Thursday, November 12, 2020, 3:19:39 PM, you wrote: > > >> On 11/11/20 7:55 PM, Bruce Momjian wrote: >>> On Thu, Nov 12, 2020 at 12:18:49AM +, Dagfinn Ilmari Mannsåker wrote: Bruce Momjian writes: > I think we could do it,

Re: Proposition for autoname columns

2020-11-12 Thread David G. Johnston
On Thu, Nov 12, 2020 at 7:18 AM Eugen Konkov wrote: > Hello Andrew, > > Thursday, November 12, 2020, 3:19:39 PM, you wrote: > > > > On 11/11/20 7:55 PM, Bruce Momjian wrote: > > > select j->>x from mytable; > > What should the column be named? > > Suppose it should be named 'as x' > +1 > > >

Re: Proposition for autoname columns

2020-11-12 Thread Eugen Konkov
Hello Andrew, Thursday, November 12, 2020, 3:19:39 PM, you wrote: > On 11/11/20 7:55 PM, Bruce Momjian wrote: >> On Thu, Nov 12, 2020 at 12:18:49AM +, Dagfinn Ilmari Mannsåker wrote: >>> Bruce Momjian writes: I think we could do it, but it would only work if the column was output

Re: Proposition for autoname columns

2020-11-12 Thread Andrew Dunstan
On 11/11/20 7:55 PM, Bruce Momjian wrote: > On Thu, Nov 12, 2020 at 12:18:49AM +, Dagfinn Ilmari Mannsåker wrote: >> Bruce Momjian writes: >>> I think we could do it, but it would only work if the column was output >>> as a single json value, and not a multi-key/value field. I am afraid if

Re: Proposition for autoname columns

2020-11-11 Thread David G. Johnston
On Wed, Nov 11, 2020 at 5:56 PM Bruce Momjian wrote: > On Thu, Nov 12, 2020 at 12:18:49AM +, Dagfinn Ilmari Mannsåker wrote: > > Bruce Momjian writes: > > > I think we could do it, but it would only work if the column was output > > > as a single json value, and not a multi-key/value field.

Re: Proposition for autoname columns

2020-11-11 Thread Bruce Momjian
On Thu, Nov 12, 2020 at 12:18:49AM +, Dagfinn Ilmari Mannsåker wrote: > Bruce Momjian writes: > > I think we could do it, but it would only work if the column was output > > as a single json value, and not a multi-key/value field. I am afraid if > > we tried to do it, the result would be too

Re: Proposition for autoname columns

2020-11-11 Thread Dagfinn Ilmari Mannsåker
Bruce Momjian writes: > On Mon, Nov 2, 2020 at 05:05:29PM +0200, Eugen Konkov wrote: >> Hello Pgsql-hackers, >> >> When selecting data from json column it named as '?column?' >> tucha=# select info->>'suma', docn from document order by id desc limit 5; >> ?column? | docn >> --+--

Re: Proposition for autoname columns

2020-11-11 Thread Eugen Konkov
Hello Bruce, Wednesday, November 11, 2020, 5:56:08 PM, you wrote: > On Mon, Nov 2, 2020 at 05:05:29PM +0200, Eugen Konkov wrote: >> Hello Pgsql-hackers, >> >> When selecting data from json column it named as '?column?' >> tucha=# select info->>'suma', docn from document order by id desc limit 5

Re: Proposition for autoname columns

2020-11-11 Thread David G. Johnston
On Wed, Nov 11, 2020 at 8:56 AM Bruce Momjian wrote: > > It would be useful if the name of column will be autoassigned based on > > name of json key. Like at next query: > > > > tucha=# select info->>'suma' as suma, docn from document order by id > desc limit 5; > > suma | docn > > +--

Re: Proposition for autoname columns

2020-11-11 Thread Bruce Momjian
On Mon, Nov 2, 2020 at 05:05:29PM +0200, Eugen Konkov wrote: > Hello Pgsql-hackers, > > When selecting data from json column it named as '?column?' > tucha=# select info->>'suma', docn from document order by id desc limit 5; > ?column? | docn > --+-- > 665.97 | 695 > 513.51 |