pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Fix assorted inconsistencies in GiST opclass support function de
11+ messages / 4 participants
[nested] [flat]
* pgsql: Fix assorted inconsistencies in GiST opclass support function de
@ 2016-01-19 17:04 Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 11+ messages in thread
From: Tom Lane @ 2016-01-19 17:04 UTC (permalink / raw)
To: pgsql-committers
Fix assorted inconsistencies in GiST opclass support function declarations.
The conventions specified by the GiST SGML documentation were widely
ignored. For example, the strategy-number argument for "consistent" and
"distance" functions is specified to be a smallint, but most of the
built-in support functions declared it as an integer, and for that matter
the core code passed it using Int32GetDatum not Int16GetDatum. None of
that makes any real difference at runtime, but it's quite confusing for
newcomers to the code, and it makes it very hard to write an amvalidate()
function that checks support function signatures. So let's try to instill
some consistency here.
Another similar issue is that the "query" argument is not of a single
well-defined type, but could have different types depending on the strategy
(corresponding to search operators with different righthand-side argument
types). Some of the functions threw up their hands and declared the query
argument as being of "internal" type, which surely isn't right ("any" would
have been more appropriate); but the majority position seemed to be to
declare it as being of the indexed data type, corresponding to a search
operator with both input types the same. So I've specified a convention
that that's what to do always.
Also, the result of the "union" support function actually must be of the
index's storage type, but the documentation suggested declaring it to
return "internal", and some of the functions followed that. Standardize
on telling the truth, instead.
Similarly, standardize on declaring the "same" function's inputs as
being of the storage type, not "internal".
Also, somebody had forgotten to add the "recheck" argument to both
the documentation of the "distance" support function and all of their
SQL declarations, even though the C code was happily using that argument.
Clean that up too.
Fix up some other omissions in the docs too, such as documenting that
union's second input argument is vestigial.
So far as the errors in core function declarations go, we can just fix
pg_proc.h and bump catversion. Adjusting the erroneous declarations in
contrib modules is more debatable: in principle any change in those
scripts should involve an extension version bump, which is a pain.
However, since these changes are purely cosmetic and make no functional
difference, I think we can get away without doing that.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/9ff60273e35cad6e9d3a4adf59d5c2455afe9d9e
Modified Files
--------------
contrib/btree_gist/btree_gist--1.1.sql | 206 +++++++++++++++---------------
contrib/cube/cube--1.1.sql | 10 +-
contrib/hstore/hstore--1.3.sql | 10 +-
contrib/intarray/intarray--1.1.sql | 14 +-
contrib/ltree/ltree--1.0.sql | 20 +--
contrib/pg_trgm/pg_trgm--1.2.sql | 14 +-
contrib/seg/seg--1.0.sql | 4 +-
contrib/tsearch2/tsearch2--1.0.sql | 4 +-
doc/src/sgml/gist.sgml | 75 ++++++++---
doc/src/sgml/ref/create_opclass.sgml | 2 +-
src/backend/access/gist/gistget.c | 4 +-
src/backend/access/gist/gistproc.c | 44 ++++++-
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_amproc.h | 2 +-
src/include/catalog/pg_proc.h | 30 +++--
src/include/utils/geo_decls.h | 3 +-
src/test/regress/expected/opr_sanity.out | 11 +-
src/test/regress/sql/opr_sanity.sql | 4 +-
18 files changed, 266 insertions(+), 193 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] 11+ messages in thread
* pgsql: Fix assorted inconsistencies in GIN opclass support function dec
@ 2016-01-20 03:32 Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 11+ messages in thread
From: Tom Lane @ 2016-01-20 03:32 UTC (permalink / raw)
To: pgsql-committers
Fix assorted inconsistencies in GIN opclass support function declarations.
GIN had some minor issues too, mostly using "internal" where something
else would be more appropriate. I went with the same approach as in
9ff60273e35cad6e, namely preferring the opclass' indexed datatype for
arguments that receive an operator RHS value, even if that's not
necessarily what they really are.
Again, this is with an eye to having a uniform rule for ginvalidate()
to check support function signatures.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/dbe2328959e12701fade6b500ad411271923d6e4
Modified Files
--------------
contrib/hstore/hstore--1.3.sql | 12 ++++-----
contrib/intarray/intarray--1.1.sql | 8 +++---
contrib/tsearch2/tsearch2--1.0.sql | 4 +--
doc/src/sgml/gin.sgml | 48 ++++++++++++++++++++----------------
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.h | 22 ++++++++---------
6 files changed, 51 insertions(+), 45 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] 11+ messages in thread
* Re: pgsql: Fix assorted inconsistencies in GIN opclass support function dec
@ 2016-05-02 20:38 Alexander Korotkov <a.korotkov@postgrespro.ru>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 11+ messages in thread
From: Alexander Korotkov @ 2016-05-02 20:38 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers
On Wed, Jan 20, 2016 at 6:32 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> contrib/hstore/hstore--1.3.sql | 12 ++++-----
> contrib/intarray/intarray--1.1.sql | 8 +++---
> contrib/tsearch2/tsearch2--1.0.sql | 4 +--
>
Hmm... Is it correct to change function signatures without extension
version bump? pg_upgraded clusters would remain with old version of these
functions. Once we have instances with same extension version but with
different signatures of its functions, there is no correct way to refer
these functions in future. I think we should do the version bump in this
case.
The same for 9ff60273e35cad6e9d3a4adf59d5c2455afe9d9e.
------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: pgsql: Fix assorted inconsistencies in GIN opclass support function dec
@ 2016-05-02 21:09 Tom Lane <tgl@sss.pgh.pa.us>
parent: Alexander Korotkov <a.korotkov@postgrespro.ru>
0 siblings, 3 replies; 11+ messages in thread
From: Tom Lane @ 2016-05-02 21:09 UTC (permalink / raw)
To: Alexander Korotkov <a.korotkov@postgrespro.ru>; +Cc: pgsql-committers
Alexander Korotkov <a.korotkov@postgrespro.ru> writes:
> On Wed, Jan 20, 2016 at 6:32 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> contrib/hstore/hstore--1.3.sql | 12 ++++-----
>> contrib/intarray/intarray--1.1.sql | 8 +++---
>> contrib/tsearch2/tsearch2--1.0.sql | 4 +--
> Hmm... Is it correct to change function signatures without extension
> version bump? pg_upgraded clusters would remain with old version of these
> functions. Once we have instances with same extension version but with
> different signatures of its functions, there is no correct way to refer
> these functions in future. I think we should do the version bump in this
> case.
It doesn't really matter, though, because there simply isn't any need to
refer to these functions from SQL. They are only useful as opclass
support functions.
But this is likely moot anyway, because of the need to bump all the
contrib modules' versions in order to install parallel-safety labels on
their functions. (I wonder why that isn't on the open-items list.)
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] 11+ messages in thread
* Re: pgsql: Fix assorted inconsistencies in GIN opclass support function dec
@ 2016-05-02 21:12 Robert Haas <robertmhaas@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
2 siblings, 1 reply; 11+ messages in thread
From: Robert Haas @ 2016-05-02 21:12 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Alexander Korotkov <a.korotkov@postgrespro.ru>; pgsql-committers
On Mon, May 2, 2016 at 5:09 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Alexander Korotkov <a.korotkov@postgrespro.ru> writes:
>> On Wed, Jan 20, 2016 at 6:32 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> contrib/hstore/hstore--1.3.sql | 12 ++++-----
>>> contrib/intarray/intarray--1.1.sql | 8 +++---
>>> contrib/tsearch2/tsearch2--1.0.sql | 4 +--
>
>> Hmm... Is it correct to change function signatures without extension
>> version bump? pg_upgraded clusters would remain with old version of these
>> functions. Once we have instances with same extension version but with
>> different signatures of its functions, there is no correct way to refer
>> these functions in future. I think we should do the version bump in this
>> case.
>
> It doesn't really matter, though, because there simply isn't any need to
> refer to these functions from SQL. They are only useful as opclass
> support functions.
>
> But this is likely moot anyway, because of the need to bump all the
> contrib modules' versions in order to install parallel-safety labels on
> their functions. (I wonder why that isn't on the open-items list.)
Because it was argued by Noah that this was 9.7 work.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
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] 11+ messages in thread
* Re: pgsql: Fix assorted inconsistencies in GIN opclass support function dec
@ 2016-05-02 21:12 Andres Freund <andres@anarazel.de>
parent: Tom Lane <tgl@sss.pgh.pa.us>
2 siblings, 0 replies; 11+ messages in thread
From: Andres Freund @ 2016-05-02 21:12 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; Robert Haas <robertmhaas@gmail.com>; +Cc: Alexander Korotkov <a.korotkov@postgrespro.ru>; pgsql-committers
On 2016-05-02 17:09:48 -0400, Tom Lane wrote:
> But this is likely moot anyway, because of the need to bump all the
> contrib modules' versions in order to install parallel-safety labels on
> their functions. (I wonder why that isn't on the open-items list.)
I think the concensus when discussing that was that that'd essentially
be a "feature", and thus too late for 9.6. I'm a bit doubtful about
that position, but I also don't have a strong opinion the other way round.
--
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] 11+ messages in thread
* Re: pgsql: Fix assorted inconsistencies in GIN opclass support function dec
@ 2016-05-02 21:15 Andres Freund <andres@anarazel.de>
parent: Robert Haas <robertmhaas@gmail.com>
0 siblings, 1 reply; 11+ messages in thread
From: Andres Freund @ 2016-05-02 21:15 UTC (permalink / raw)
To: Robert Haas <robertmhaas@gmail.com>; Noah Misch <noah@leadboat.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Alexander Korotkov <a.korotkov@postgrespro.ru>; pgsql-committers
On 2016-05-02 17:12:41 -0400, Robert Haas wrote:
> On Mon, May 2, 2016 at 5:09 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > Alexander Korotkov <a.korotkov@postgrespro.ru> writes:
> > But this is likely moot anyway, because of the need to bump all the
> > contrib modules' versions in order to install parallel-safety labels on
> > their functions. (I wonder why that isn't on the open-items list.)
>
> Because it was argued by Noah that this was 9.7 work.
Thinking about this again, I think that's not a good approach: It'll
mean we've to do very similar testing in 9.7 again. I'd rather label as
much as possible in one release.
--
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] 11+ messages in thread
* Re: [COMMITTERS] pgsql: Fix assorted inconsistencies in GIN opclass support function dec
@ 2016-05-03 02:58 Robert Haas <robertmhaas@gmail.com>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 0 replies; 11+ messages in thread
From: Robert Haas @ 2016-05-03 02:58 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Noah Misch <noah@leadboat.com>; Tom Lane <tgl@sss.pgh.pa.us>; Alexander Korotkov <a.korotkov@postgrespro.ru>; pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
On Mon, May 2, 2016 at 5:15 PM, Andres Freund <andres@anarazel.de> wrote:
> On 2016-05-02 17:12:41 -0400, Robert Haas wrote:
>> On Mon, May 2, 2016 at 5:09 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> > Alexander Korotkov <a.korotkov@postgrespro.ru> writes:
>> > But this is likely moot anyway, because of the need to bump all the
>> > contrib modules' versions in order to install parallel-safety labels on
>> > their functions. (I wonder why that isn't on the open-items list.)
>>
>> Because it was argued by Noah that this was 9.7 work.
>
> Thinking about this again, I think that's not a good approach: It'll
> mean we've to do very similar testing in 9.7 again. I'd rather label as
> much as possible in one release.
Yeah, I somewhat agree, but there's also no patch for this, yet.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: pgsql: Fix assorted inconsistencies in GIN opclass support function dec
@ 2016-05-03 08:32 Alexander Korotkov <a.korotkov@postgrespro.ru>
parent: Tom Lane <tgl@sss.pgh.pa.us>
2 siblings, 1 reply; 11+ messages in thread
From: Alexander Korotkov @ 2016-05-03 08:32 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers
On Tue, May 3, 2016 at 12:09 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Alexander Korotkov <a.korotkov@postgrespro.ru> writes:
> > On Wed, Jan 20, 2016 at 6:32 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> contrib/hstore/hstore--1.3.sql | 12 ++++-----
> >> contrib/intarray/intarray--1.1.sql | 8 +++---
> >> contrib/tsearch2/tsearch2--1.0.sql | 4 +--
>
> > Hmm... Is it correct to change function signatures without extension
> > version bump? pg_upgraded clusters would remain with old version of
> these
> > functions. Once we have instances with same extension version but with
> > different signatures of its functions, there is no correct way to refer
> > these functions in future. I think we should do the version bump in this
> > case.
>
> It doesn't really matter, though, because there simply isn't any need to
> refer to these functions from SQL. They are only useful as opclass
> support functions.
>
What if we'll want to reuse some on these functions in new opclass?
Assumption that we don't need to refer these functions from SQL seems
dangerous to me.
If pg_upgraded instances are OK to leave with old function definitions, why
do we bother about new instances?
------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Re: pgsql: Fix assorted inconsistencies in GIN opclass support function dec
@ 2016-05-03 13:32 Tom Lane <tgl@sss.pgh.pa.us>
parent: Alexander Korotkov <a.korotkov@postgrespro.ru>
0 siblings, 1 reply; 11+ messages in thread
From: Tom Lane @ 2016-05-03 13:32 UTC (permalink / raw)
To: Alexander Korotkov <a.korotkov@postgrespro.ru>; +Cc: pgsql-committers
Alexander Korotkov <a.korotkov@postgrespro.ru> writes:
> On Tue, May 3, 2016 at 12:09 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> It doesn't really matter, though, because there simply isn't any need to
>> refer to these functions from SQL.
> What if we'll want to reuse some on these functions in new opclass?
What context do you imagine that happening in? Surely no other extension
would attempt to re-use them. If, say, hstore itself wanted to reuse
these functions, that would be in a new version of hstore--n.n.sql, so
there's no problem.
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] 11+ messages in thread
* Re: Re: pgsql: Fix assorted inconsistencies in GIN opclass support function dec
@ 2016-05-03 18:47 Alexander Korotkov <a.korotkov@postgrespro.ru>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 11+ messages in thread
From: Alexander Korotkov @ 2016-05-03 18:47 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers
On Tue, May 3, 2016 at 4:32 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Alexander Korotkov <a.korotkov@postgrespro.ru> writes:
> > On Tue, May 3, 2016 at 12:09 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> It doesn't really matter, though, because there simply isn't any need to
> >> refer to these functions from SQL.
>
> > What if we'll want to reuse some on these functions in new opclass?
>
> What context do you imagine that happening in? Surely no other extension
> would attempt to re-use them. If, say, hstore itself wanted to reuse
> these functions, that would be in a new version of hstore--n.n.sql, so
> there's no problem.
>
Let's consider particular example: gin_extract_hstore() function.
In PostgreSQL 9.6 hstore 1.3 it's gin_extract_hstore(hstore, internal)
RETURNS internal.
In PostgreSQL 9.5 hstore 1.3 it's gin_extract_hstore(internal, internal)
RETURNS internal.
After pg_upgrade 9.5 => 9.6 it will be still gin_extract_hstore(internal,
internal) RETURNS internal.
Thus, in 9.6 hstore 1.3 we can meet either
1. gin_extract_hstore(internal, internal) RETURNS internal
2. gin_extract_hstore(hstore, internal) RETURNS internal
Then, if we want to reuse this function in hstore 1.4, we will need to
write a migration script hstore--1.3--1.4.sql. How can we refer
gin_extract_hstore() function from this script?
------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
^ permalink raw reply [nested|flat] 11+ messages in thread
end of thread, other threads:[~2016-05-03 18:47 UTC | newest]
Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-01-19 17:04 pgsql: Fix assorted inconsistencies in GiST opclass support function de Tom Lane <tgl@sss.pgh.pa.us>
2016-01-20 03:32 pgsql: Fix assorted inconsistencies in GIN opclass support function dec Tom Lane <tgl@sss.pgh.pa.us>
2016-05-02 20:38 ` Re: pgsql: Fix assorted inconsistencies in GIN opclass support function dec Alexander Korotkov <a.korotkov@postgrespro.ru>
2016-05-02 21:09 ` Re: pgsql: Fix assorted inconsistencies in GIN opclass support function dec Tom Lane <tgl@sss.pgh.pa.us>
2016-05-02 21:12 ` Re: pgsql: Fix assorted inconsistencies in GIN opclass support function dec Robert Haas <robertmhaas@gmail.com>
2016-05-02 21:15 ` Re: pgsql: Fix assorted inconsistencies in GIN opclass support function dec Andres Freund <andres@anarazel.de>
2016-05-03 02:58 ` Re: [COMMITTERS] pgsql: Fix assorted inconsistencies in GIN opclass support function dec Robert Haas <robertmhaas@gmail.com>
2016-05-02 21:12 ` Re: pgsql: Fix assorted inconsistencies in GIN opclass support function dec Andres Freund <andres@anarazel.de>
2016-05-03 08:32 ` Re: pgsql: Fix assorted inconsistencies in GIN opclass support function dec Alexander Korotkov <a.korotkov@postgrespro.ru>
2016-05-03 13:32 ` Re: Re: pgsql: Fix assorted inconsistencies in GIN opclass support function dec Tom Lane <tgl@sss.pgh.pa.us>
2016-05-03 18:47 ` Re: Re: pgsql: Fix assorted inconsistencies in GIN opclass support function dec Alexander Korotkov <a.korotkov@postgrespro.ru>
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