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

Commitf7ad874

Browse files
committed
Since SQL:2003, the array size specification in the SQL ARRAY syntax has
been optional.
1 parentf7ef575 commitf7ad874

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

‎doc/src/sgml/array.sgml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.66 2008/04/28 14:48:57 alvherre Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.67 2008/10/29 11:24:52 petere Exp $ -->
22

33
<sect1 id="arrays">
44
<title>Arrays</title>
@@ -76,9 +76,12 @@ CREATE TABLE tictactoe (
7676
<programlisting>
7777
pay_by_quarter integer ARRAY[4],
7878
</programlisting>
79-
This syntax requires an integer constant to denote the array size.
79+
Or, if no array size is to be specified:
80+
<programlisting>
81+
pay_by_quarter integer ARRAY,
82+
</programlisting>
8083
As before, however, <productname>PostgreSQL</> does not enforce the
81-
size restriction.
84+
size restriction in any case.
8285
</para>
8386
</sect2>
8487

‎src/backend/parser/gram.y

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.631 2008/10/28 14:09:45 petere Exp $
14+
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.632 2008/10/29 11:24:53 petere Exp $
1515
*
1616
* HISTORY
1717
* AUTHORDATEMAJOR EVENT
@@ -7124,19 +7124,29 @@ Typename:SimpleTypename opt_array_bounds
71247124
$$->arrayBounds =$3;
71257125
$$->setof =TRUE;
71267126
}
7127+
/* SQL standard syntax, currently only one-dimensional*/
71277128
| SimpleTypename ARRAY'[' Iconst']'
71287129
{
7129-
/* SQL99's redundant syntax*/
71307130
$$ =$1;
71317131
$$->arrayBounds = list_make1(makeInteger($4));
71327132
}
71337133
| SETOF SimpleTypename ARRAY'[' Iconst']'
71347134
{
7135-
/* SQL99's redundant syntax*/
71367135
$$ =$2;
71377136
$$->arrayBounds = list_make1(makeInteger($5));
71387137
$$->setof =TRUE;
71397138
}
7139+
| SimpleTypename ARRAY
7140+
{
7141+
$$ =$1;
7142+
$$->arrayBounds = list_make1(makeInteger(-1));
7143+
}
7144+
| SETOF SimpleTypename ARRAY
7145+
{
7146+
$$ =$2;
7147+
$$->arrayBounds = list_make1(makeInteger(-1));
7148+
$$->setof =TRUE;
7149+
}
71407150
;
71417151

71427152
opt_array_bounds:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp