Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf974212

Browse files
committed
Deprecate the use of => as an operator name.
In HEAD, emit a warning when an operator named => is defined.In both HEAD and the backbranches (except in 8.2, where contribmodules do not have documentation), document that hstore's text =>text operator may be removed in a future release, and encourage theuse of the hstore(text, text) function instead. This function onlyexists in HEAD (previously, it was called tconvert), so backpatchit back to 8.2, when hstore was added. Per discussion.
1 parent9b2c14c commitf974212

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

‎doc/src/sgml/hstore.sgml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/hstore.sgml,v 1.10 2010/06/18 03:52:03 rhaas Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/hstore.sgml,v 1.11 2010/06/22 11:36:16 rhaas Exp $ -->
22

33
<sect1 id="hstore">
44
<title>hstore</title>
@@ -225,6 +225,14 @@
225225
</para>
226226
</note>
227227

228+
<note>
229+
<para>
230+
The <literal>=&gt;</> operator is deprecated and may be removed in a
231+
future release. Use the <literal>hstore(text, text)</literal> function
232+
instead.
233+
</para>
234+
</note>
235+
228236
<table id="hstore-func-table">
229237
<title><type>hstore</> Functions</title>
230238

@@ -265,6 +273,14 @@
265273
<entry><literal>"a"=&gt;"1","b"=&gt;"2"</literal></entry>
266274
</row>
267275

276+
<row>
277+
<entry><function>hstore(text, text)</function></entry>
278+
<entry><type>hstore</type></entry>
279+
<entry>make single-item <type>hstore</></entry>
280+
<entry><literal>hstore('a', 'b')</literal></entry>
281+
<entry><literal>"a"=&gt;"b"</literal></entry>
282+
</row>
283+
268284
<row>
269285
<entry><function>akeys(hstore)</function></entry>
270286
<entry><type>text[]</type></entry>

‎doc/src/sgml/ref/create_operator.sgml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/create_operator.sgml,v 1.52 2010/04/03 07:22:58 petere Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/create_operator.sgml,v 1.53 2010/06/22 11:36:16 rhaas Exp $
33
PostgreSQL documentation
44
-->
55

@@ -71,6 +71,12 @@ CREATE OPERATOR <replaceable>name</replaceable> (
7171
parse SQL-compliant commands without requiring spaces between tokens.
7272
</para>
7373
</listitem>
74+
<listitem>
75+
<para>
76+
The use of <literal>=&gt;</> as an operator name is deprecated. It may
77+
be disallowed altogether in a future release.
78+
</para>
79+
</listitem>
7480
</itemizedlist>
7581
</para>
7682

‎src/backend/commands/operatorcmds.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.45 2010/02/14 18:42:14 rhaas Exp $
12+
* $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.46 2010/06/22 11:36:16 rhaas Exp $
1313
*
1414
* DESCRIPTION
1515
* The "DefineFoo" routines take the parse tree and pick out the
@@ -88,6 +88,16 @@ DefineOperator(List *names, List *parameters)
8888
/* Convert list of names to a name and namespace */
8989
oprNamespace=QualifiedNameGetCreationNamespace(names,&oprName);
9090

91+
/*
92+
* The SQL standard committee has decided that => should be used for
93+
* named parameters; therefore, a future release of PostgreSQL may
94+
* disallow it as the name of a user-defined operator.
95+
*/
96+
if (strcmp(oprName,"=>")==0)
97+
ereport(WARNING,
98+
(errmsg("=> is deprecated as an operator name"),
99+
errdetail("This name may be disallowed altogether in future versions of PostgreSQL.")));
100+
91101
/* Check we have creation rights in target namespace */
92102
aclresult=pg_namespace_aclcheck(oprNamespace,GetUserId(),ACL_CREATE);
93103
if (aclresult!=ACLCHECK_OK)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp