Re: plpgsql select into

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Roger Mason <rmason(at)mun(dot)ca>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: plpgsql select into
Date: 2021-08-20 16:07:40
Message-ID: 1915560.1629475660@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Roger Mason <rmason(at)mun(dot)ca> writes:
> Yes, if I omit the INTO clause I get data returned. So then how do I
> insert the result of the plpgsql call into a table? This is what
> happens if I try calling 'select into' in psql:

> select into info_table from (select get_info('1043_1')) as info_split;
> SELECT 1288
> test=> select * from info_table ;
> --
> (1288 rows)

You selected zero columns (which psql is not very good at displaying :-().
Try

select * into info_table from (select get_info('1043_1')) as info_split;

BTW, that could be simplified a lot:

select * into info_table from get_info('1043_1');

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message David G. Johnston 2021-08-20 16:12:03 Re: plpgsql select into
Previous Message Roger Mason 2021-08-20 15:34:20 Re: plpgsql select into