Re: Can't find the right generated column syntax

"David G. Johnston" <[email protected]> Mon, 25 Nov 2019 20:35:50 -0700
Newsgroups gmane.comp.db.postgresql.novice
Message-ID <CAKFQuwbUVHmYyCfkvzUwwcnod-dbbJEai0dg7vcEUDy8OR7H8g@mail.gmail.com>
--000000000000a3e4470598379317
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Monday, November 25, 2019, Bzzzz <[email protected]> wrote:

>
>
> CREATE TABLE tst_timerange(a timestamptz, b timestamptz, c tstzrange
> generated always as ( SELECT tstzrange(a, b, '[)' ) ) stored); ERROR:
> syntax error at or near "SELECT" LINE 1: ... b timestamptz, c tstzrange
> generated always as ( SELECT tst...
>
>
>
>
Correct, i think, you recognized that removing select is what the error was
telling you.


>
>
>
> CREATE TABLE tst_timerange(a timestamptz, b timestamptz, c tstzrange
> generated always as ( ('[a,b(') ) stored); ERROR:  malformed range
> literal: "[a,b(" LINE 1: ...b timestamptz, c tstzrange generated always
> as ( ('[a,b(') )...
>
>
>
Also probably correct if you recognize that [( doesn=E2=80=99t make sense a=
s a
range boundary specification.

David J.

--000000000000a3e4470598379317
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<br><br>On Monday, November 25, 2019, Bzzzz &lt;<a href=3D"mailto:lazyvirus=
@gmx.com">[email protected]</a>&gt; wrote:<br><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex=
"><br>
<br>
CREATE TABLE tst_timerange(a timestamptz, b timestamptz, c tstzrange<br>
generated always as ( SELECT tstzrange(a, b, &#39;[)&#39; ) ) stored); ERRO=
R:<br>
syntax error at or near &quot;SELECT&quot; LINE 1: ... b timestamptz, c tst=
zrange<br>
generated always as ( SELECT tst...<br>
<br><br></blockquote><blockquote class=3D"gmail_quote" style=3D"margin:0 0 =
0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br></blockquote><div><=
br></div><div>Correct, i think, you recognized that removing select is what=
 the error was telling you.</div><div>=C2=A0</div><blockquote class=3D"gmai=
l_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left=
:1ex"><br></blockquote><blockquote class=3D"gmail_quote" style=3D"margin:0 =
0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
CREATE TABLE tst_timerange(a timestamptz, b timestamptz, c tstzrange<br>
generated always as ( (&#39;[a,b(&#39;) ) stored); ERROR:=C2=A0 malformed r=
ange<br>
literal: &quot;[a,b(&quot; LINE 1: ...b timestamptz, c tstzrange generated =
always<br>
as ( (&#39;[a,b(&#39;) )...<br>
<br><br>
</blockquote><div><br></div><div>Also probably correct if you recognize tha=
t [( doesn=E2=80=99t make sense as a range boundary specification.</div><di=
v><br></div><div>David J.</div><div>=C2=A0</div>

--000000000000a3e4470598379317--