how can I do the following in plpgsql?
insert multiple rows in a table
get the ids (serial) into a temp table (not the client)
for one row it will be like this
insert into mytable(mycolumn)values(123)returning id into some_variable;
now for multiple rows (using insert select) it will be like
i
Rikard Pavelic writes:
> I'm arguing that is seems wrong that I need to match alias name like this
> select t from (select t from t) t
> or like this
> select sq from (select sq from t sq) sq
> to get unwrapped type.
This reminds me of the old joke ...
Patient: Doctor, it hurts when I do
On Sat, Sep 18, 2010 at 12:40 PM, Rikard Pavelic
wrote:
> On 18.9.2010 11:36, Arjen Nienhuis wrote:
>> I'm not sure what you want but maybe it's this:
>>
>>
>> => select * from (select t from t) sq;
>> t
>> ---
>> (1,x)
>> (1 row)
>>
>> => select (sq.t).* from (select t from t) sq;
>> a |
On 18.9.2010 11:36, Arjen Nienhuis wrote:
> I'm not sure what you want but maybe it's this:
>
>
> => select * from (select t from t) sq;
>t
> ---
> (1,x)
> (1 row)
>
> => select (sq.t).* from (select t from t) sq;
> a | b
> ---+---
> 1 | x
> (1 row)
>
>
I know how to expand record to
On Sat, Sep 18, 2010 at 9:31 AM, Rikard Pavelic
wrote:
> On 18.9.2010 4:31, Tom Lane wrote:
>> Rikard Pavelic writes:
>>
>>> For basic query:
>>> select t from t
>>> result is of type t.
>>>
>> yeah ...
>>
>>
>>> If I query:
>>> select sq from (select t from t) sq;
>>> result is of type record.
>
On 18.9.2010 4:31, Tom Lane wrote:
> Rikard Pavelic writes:
>
>> For basic query:
>> select t from t
>> result is of type t.
>>
> yeah ...
>
>
>> If I query:
>> select sq from (select t from t) sq;
>> result is of type record.
>>
> yeah ... it's a record containing a single field o