Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f7ad874

Browse files
committed
Since SQL:2003, the array size specification in the SQL ARRAY syntax has
been optional.
1 parent f7ef575 commit f7ad874

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

doc/src/sgml/array.sgml

+6-3
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

+13-3
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
* AUTHOR DATE MAJOR 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)