Re: Can't find the right generated column syntax
"David G. Johnston" <[email protected]> Mon, 25 Nov 2019 20:58:29 -0700
| Newsgroups | gmane.comp.db.postgresql.novice |
|---|---|
| Message-ID | <CAKFQuwaURLKtX3mCvEjoK6dLnEsuPb3bTTxVURFbuUsUE2Akhg@mail.gmail.com> |
--000000000000acc659059837e45c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Monday, November 25, 2019, David G. Johnston <[email protected]= > wrote: > > > On Monday, November 25, 2019, Bzzzz <[email protected]> wrote: > >> >> >> 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= as a > range boundary specification. > > Nevermind this one - getting the quoting correct with a literal input expression is why using the function is much easier. Even swapping ) for ( isn=E2=80=99t enough though its close - just need to get a and b to be trea= ted as column references. David J. --000000000000acc659059837e45c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Monday, November 25, 2019, David G. Johnston <<a href=3D"mailto:david= [email protected]">[email protected]</a>> wrote:<br><blockq= uote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc = solid;padding-left:1ex"><br><br>On Monday, November 25, 2019, Bzzzz <<a = href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>&g= t; wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;b= order-left:1px #ccc solid;padding-left:1ex"><br></blockquote><blockquote cl= ass=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;p= adding-left:1ex"> <br> CREATE TABLE tst_timerange(a timestamptz, b timestamptz, c tstzrange<br> generated always as ( ('[a,b(') ) stored); ERROR:=C2=A0 malformed r= ange<br> literal: "[a,b(" LINE 1: ...b timestamptz, c tstzrange generated = always<br> as ( ('[a,b(') )...<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></blockquote><div><br></div><div>Nevermind this one - getting t= he quoting correct with a literal input expression is why using the functio= n is much easier.=C2=A0 Even swapping ) for ( isn=E2=80=99t enough though i= ts close - just need to get a and b to be treated as column references.</di= v><div><br></div><div>David J.</div> --000000000000acc659059837e45c--