Re: SET syntax in INSERT

From: Rob Wultsch <wultsch(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: SET syntax in INSERT
Date: 2009-08-25 18:19:50
Message-ID: 2c5ef4e30908251119i1f8dfdbcy7990e01563651d6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 25, 2009 at 10:36 AM, Pavel Stehule<pavel(dot)stehule(at)gmail(dot)com> wrote:
> 2009/8/25 Rob Wultsch <wultsch(at)gmail(dot)com>:
>> Given the recent discussion of "DELETE syntax on JOINS"  I thought it
>> might be interesting to bring a bit MySQL syntax that is in somewhat
>> widespread use, generally create somewhat cleaner code and I imagine
>> would not break much if implemented.
>>
>> MySQL allows INSERTs of the form:
>>
>> INSERT INTO t SET
>> col1='val1',
>> col2='va21',
>> col3='val3',
>> col4='val4',
>> col5='val5',
>> col6='val6',
>> col7='val7',
>> col8='val8',
>> col9='val9',
>> col10='val10',
>> col11='val11',
>> col12='val12',
>> col13='val13',
>> col14='val14',
>> col15='val15';
>>
>> Which I think sometimes compares very favorably
>> INSERT INTO t
>> (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15)
>> VALUES
>> ('val1','val2','val3','val4','val5','val6','val7','val8','val9','val10','val11','val12','val13','val14','val15')
>>
>> Probably a pipe dream...
>
> -1 PostgreSQL isn't MySQL!
>
> Regards
> Pavel Stehule

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).

--
Rob Wultsch
wultsch(at)gmail(dot)com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2009-08-25 19:00:12 Re: SET syntax in INSERT
Previous Message Heikki Linnakangas 2009-08-25 18:19:19 Re: SET syntax in INSERT