pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Fix documentation of argument type of json_agg and jsonb_agg
7+ messages / 3 participants
[nested] [flat]
* pgsql: Fix documentation of argument type of json_agg and jsonb_agg
@ 2014-12-22 19:21 Andrew Dunstan <andrew@dunslane.net>
0 siblings, 0 replies; 7+ messages in thread
From: Andrew Dunstan @ 2014-12-22 19:21 UTC (permalink / raw)
To: pgsql-committers
Fix documentation of argument type of json_agg and jsonb_agg
json_agg was originally designed to aggregate records. However, it soon
became clear that it is useful for aggregating all kinds of values and
that's what we have on 9.3 and 9.4, and in head for it and jsonb_agg.
The documentation suggested otherwise, so this fixes it.
Branch
------
REL9_3_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/cc82141d9a4d2d83aea6691fad2d8fbbd1a277c2
Modified Files
--------------
doc/src/sgml/func.sgml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix documentation of argument type of json_agg and jsonb_agg
@ 2014-12-22 19:22 Andrew Dunstan <andrew@dunslane.net>
0 siblings, 0 replies; 7+ messages in thread
From: Andrew Dunstan @ 2014-12-22 19:22 UTC (permalink / raw)
To: pgsql-committers
Fix documentation of argument type of json_agg and jsonb_agg
json_agg was originally designed to aggregate records. However, it soon
became clear that it is useful for aggregating all kinds of values and
that's what we have on 9.3 and 9.4, and in head for it and jsonb_agg.
The documentation suggested otherwise, so this fixes it.
Branch
------
REL9_4_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/302bed04b2e2c6074cccc3b63aa1962c5a4461dd
Modified Files
--------------
doc/src/sgml/func.sgml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix documentation of argument type of json_agg and jsonb_agg
@ 2014-12-22 19:22 Andrew Dunstan <andrew@dunslane.net>
0 siblings, 1 reply; 7+ messages in thread
From: Andrew Dunstan @ 2014-12-22 19:22 UTC (permalink / raw)
To: pgsql-committers
Fix documentation of argument type of json_agg and jsonb_agg
json_agg was originally designed to aggregate records. However, it soon
became clear that it is useful for aggregating all kinds of values and
that's what we have on 9.3 and 9.4, and in head for it and jsonb_agg.
The documentation suggested otherwise, so this fixes it.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/b2d145bff02e5f278649aca0e6fb6142ea2f298d
Modified Files
--------------
doc/src/sgml/func.sgml | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: pgsql: Fix documentation of argument type of json_agg and jsonb_agg
@ 2014-12-22 19:34 Tom Lane <tgl@sss.pgh.pa.us>
parent: Andrew Dunstan <andrew@dunslane.net>
0 siblings, 1 reply; 7+ messages in thread
From: Tom Lane @ 2014-12-22 19:34 UTC (permalink / raw)
To: Andrew Dunstan <andrew@dunslane.net>; +Cc: pgsql-committers
Andrew Dunstan <andrew@dunslane.net> writes:
> Fix documentation of argument type of json_agg and jsonb_agg
> json_agg was originally designed to aggregate records. However, it soon
> became clear that it is useful for aggregating all kinds of values and
> that's what we have on 9.3 and 9.4, and in head for it and jsonb_agg.
> The documentation suggested otherwise, so this fixes it.
Claiming that the argument type is "expression" is not a fix. I don't
mind using that terminology in the first table column, but the second
column is supposed to be the truth not handwaving.
The actual declaration of the argument type is "anyelement", and I think
we use that to document other such functions.
regards, tom lane
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: pgsql: Fix documentation of argument type of json_agg and jsonb_agg
@ 2014-12-22 23:10 Andrew Dunstan <andrew@dunslane.net>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 7+ messages in thread
From: Andrew Dunstan @ 2014-12-22 23:10 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers
On 12/22/2014 02:34 PM, Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.net> writes:
>> Fix documentation of argument type of json_agg and jsonb_agg
>> json_agg was originally designed to aggregate records. However, it soon
>> became clear that it is useful for aggregating all kinds of values and
>> that's what we have on 9.3 and 9.4, and in head for it and jsonb_agg.
>> The documentation suggested otherwise, so this fixes it.
> Claiming that the argument type is "expression" is not a fix. I don't
> mind using that terminology in the first table column, but the second
> column is supposed to be the truth not handwaving.
>
> The actual declaration of the argument type is "anyelement", and I think
> we use that to document other such functions.
>
>
Oh, I thought I had seen "expression" there. It looks like we're using
"any" elsewhere, so I'll use that. While I'm at it I'll remove the quote
marks around the arguments to json_object_agg().
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: pgsql: Fix documentation of argument type of json_agg and jsonb_agg
@ 2014-12-22 23:45 Tom Lane <tgl@sss.pgh.pa.us>
parent: Andrew Dunstan <andrew@dunslane.net>
0 siblings, 1 reply; 7+ messages in thread
From: Tom Lane @ 2014-12-22 23:45 UTC (permalink / raw)
To: Andrew Dunstan <andrew@dunslane.net>; +Cc: pgsql-committers
Andrew Dunstan <andrew@dunslane.net> writes:
> On 12/22/2014 02:34 PM, Tom Lane wrote:
>> The actual declaration of the argument type is "anyelement", and I think
>> we use that to document other such functions.
> Oh, I thought I had seen "expression" there. It looks like we're using
> "any" elsewhere, so I'll use that. While I'm at it I'll remove the quote
> marks around the arguments to json_object_agg().
[ looks around... ] Looks like there are some of each. Don't know how
important consistency is here; I'm satisfied with "any", even though it
doesn't exactly match the catalogs.
regards, tom lane
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: pgsql: Fix documentation of argument type of json_agg and jsonb_agg
@ 2014-12-23 02:19 David G Johnston <david.g.johnston@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 7+ messages in thread
From: David G Johnston @ 2014-12-23 02:19 UTC (permalink / raw)
To: pgsql-committers
Tom Lane-2 wrote
> Andrew Dunstan <
> andrew@
> > writes:
>> On 12/22/2014 02:34 PM, Tom Lane wrote:
>>> The actual declaration of the argument type is "anyelement", and I think
>>> we use that to document other such functions.
>
>> Oh, I thought I had seen "expression" there. It looks like we're using
>> "any" elsewhere, so I'll use that. While I'm at it I'll remove the quote
>> marks around the arguments to json_object_agg().
>
> [ looks around... ] Looks like there are some of each. Don't know how
> important consistency is here; I'm satisfied with "any", even though it
> doesn't exactly match the catalogs.
Its less a matter of uniformity and more that we don't seem to enforce the
implied semantic difference between "any" and "anyelement".
Based upon:
http://www.postgresql.org/docs/9.4/interactive/datatype-pseudo.html
And the corresponding comment in:
http://www.postgresql.org/docs/9.4/interactive/extend-type-system.html#EXTEND-TYPES-POLYMORPHIC
"any" is not defined to be polymorphic - it is just simply a placeholder for
an unrestricted type. Thus for functions that are not fully polymorphic
(defined for me as either having multiple inputs or an input and a matched
output) the use of "any" would be appropriate and would imply - if used
consistently - that the type of the output is fixed for all input types. I
would probably be happy simply saying that the output type has to be
polymorphic and allow for a multiple-input "any" declaration (any, but all
the same).
The main flaw in my reasoning about "any" is that there is no way to define
an "any"-semantic parameter that is restricted to non-array, enums, etc... -
you have to use a polymorphic type no matter the output type if you need
such a restriction.
On the linked table would it be accurate to put a comment that for practical
purposes "any" and "anyelement" are synonyms in their current usage in the
documentation and, if correct, in actual usage? Also, the word "input" for
"any" seems to be a noise word. If it is then the "alias" behavior is
implied on the table otherwise there is a distinction that could use
elaboration there.
Making the links to 35.2.5 read:
(Polymorphic - see 35.2.5) would help with immediate context without
diverting the user.
If "any" cannot be used polymorphically that restriction is only defined by
omission and the subtle fact that "any" has not been defined to be a
polymorphic type.
Sorry for the rambling, and I should go and do some experimentation to see
how things work in reality, but that is basically the point since I should
know how/when to use "any" or "anyelement" from the documentation alone; the
choice of wording for the json stuff is simply an artifact of that and the
history of the two types - which may be worth mentioning.
David J.
--
View this message in context: http://postgresql.nabble.com/pgsql-Fix-documentation-of-argument-type-of-json-agg-and-jsonb-agg-tp58...
Sent from the PostgreSQL - committers mailing list archive at Nabble.com.
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2014-12-23 02:19 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-12-22 19:21 pgsql: Fix documentation of argument type of json_agg and jsonb_agg Andrew Dunstan <andrew@dunslane.net>
2014-12-22 19:22 pgsql: Fix documentation of argument type of json_agg and jsonb_agg Andrew Dunstan <andrew@dunslane.net>
2014-12-22 19:22 pgsql: Fix documentation of argument type of json_agg and jsonb_agg Andrew Dunstan <andrew@dunslane.net>
2014-12-22 19:34 ` Tom Lane <tgl@sss.pgh.pa.us>
2014-12-22 23:10 ` Andrew Dunstan <andrew@dunslane.net>
2014-12-22 23:45 ` Tom Lane <tgl@sss.pgh.pa.us>
2014-12-23 02:19 ` David G Johnston <david.g.johnston@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox