pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: marcelo <marcelo.nicolet@gmail.com>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: Select into table%ROWTYPE failed
Date: Tue, 18 Sep 2018 13:10:26 -0400
Message-ID: <16266.1537290626@sss.pgh.pa.us> (raw)
In-Reply-To: <101ff717-5edc-b671-1903-098ae1f74bd3@gmail.com>
References: <101ff717-5edc-b671-1903-098ae1f74bd3@gmail.com>

marcelo <marcelo.nicolet@gmail.com> writes:
> What was wrong in the first approach?

plpgsql's "SELECT INTO" expects a one-for-one match between the output
columns of the SELECT and the columns of the INTO destination.  So I'd
expect something like this to work:

DECLARE
  ranger billnumberrange%ROWTYPE;
BEGIN
 SELECT * FROM billnumberrange WHERE ... INTO ranger;

Your example clearly wasn't selecting all the columns, and it
wasn't clear whether you paid any attention to column ordering;
but both of those matter.

			regards, tom lane




view thread (3+ messages)  latest in thread

Message-ID: <16266.1537290626@sss.pgh.pa.us>
Permalink:  ../16266.1537290626@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16266.1537290626@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, marcelo.nicolet@gmail.com
  Subject: Re: Select into table%ROWTYPE failed
  In-Reply-To: <16266.1537290626@sss.pgh.pa.us>
  References: <101ff717-5edc-b671-1903-098ae1f74bd3@gmail.com> <16266.1537290626@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox