Re: select (17, 42)::s.t2 into... fails with "invalid input syntax"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bryn Llewellyn <bryn(at)yugabyte(dot)com>
Cc: pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: select (17, 42)::s.t2 into... fails with "invalid input syntax"
Date: 2023-03-09 02:26:40
Message-ID: 281321.1678328800@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bryn Llewellyn <bryn(at)yugabyte(dot)com> writes:
> select (17, 42)::s.t2 into r2;
> [ doesn't work ]

This would work as

select 17, 42 into r2;

In general, SELECT INTO with a composite target expects to see
a source column per target field. If you want to assign a
composite value to the whole target, don't use SELECT INTO;
use an assignment statement.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message wangw.fnst@fujitsu.com 2023-03-09 02:26:44 RE: Support logical replication of DDLs
Previous Message David G. Johnston 2023-03-09 00:50:41 Re: select (17, 42)::s.t2 into... fails with "invalid input syntax"