Re: SET syntax in INSERT - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: SET syntax in INSERT
Date
Msg-id 162867790908251200s2b1bc052w413e8113f46f6d1e@mail.gmail.com
Whole thread Raw
In response to Re: SET syntax in INSERT  (Rob Wultsch <wultsch@gmail.com>)
List pgsql-hackers
>
> For an insert with many columns or with large value this syntax can
> significantly improve readability. So it wasn't invented here, so
> what? I don't see a downside to allowing this syntax other than MySQL
> used it first, and there are multiple upsides (readability, easier
> transitions).
>

Insert of too much columns is signal, so your database is badly designed.

If you afraid about readability, you can you named parameters - I hope
so this feature will be early committed. It can look like:

CREATE OR REPLACE FUNCTION insert_tab(p1 varchar = NULL, p2 varchar =
NULL, p3 varchar = NULL, ...
RETURNS void AS $$ INSERT INTO tab(p1,p2,p3,p4....   VALUES($1,$2,$3,$4, ...

then you can call this procedure

SELECT insert_tab(10 as p1, 20 as p3);

regards
Pavel Stehule


> --
> Rob Wultsch
> wultsch@gmail.com
>


pgsql-hackers by date:

Previous
From: Stef Walter
Date:
Subject: Re: pg_hba.conf: samehost and samenet
Next
From: Alvaro Herrera
Date:
Subject: Re: pg_hba.conf: samehost and samenet