Re: Insert vs Update syntax

From: Kaloyan Iliev <kaloyan(at)digsys(dot)bg>
To: Clodoaldo <clodoaldo(dot)pinto(dot)neto(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Insert vs Update syntax
Date: 2008-02-29 16:56:51
Message-ID: 47C83953.9000108@digsys.bg
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=windows-1251"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
I've solved this problem for me (Perl). I have a module DBAPI and write
a function InsertIntoTable($table_name, $hash_with_values,
$data_base_handler).<br>
I send the parms to the function in the hash (key1 =&gt; value1, key2
=&gt; value2 ...) and in the function I compose the insert and execute
it.<br>
<br>
INSERT INTO $table_name (key1, key2, key3) VALUES (value1, value2,
value3);<br>
<br>
So I suggest you write such function and solve most of your problems:-)<br>
<br>
Regards, <br>
  Kaloyan Iliev<br>
 <br>
Clodoaldo wrote:
<blockquote
cite="mida595de7a0802290831y785c402ewcf9abdec00dac9e8(at)mail(dot)gmail(dot)com"
type="cite">
<pre wrap="">2008/2/29, Martijn van Oosterhout <a class="moz-txt-link-rfc2396E" href="mailto:kleptog(at)svana(dot)org">&lt;kleptog(at)svana(dot)org&gt;</a>:
</pre>
<blockquote type="cite">
<pre wrap="">On Fri, Feb 29, 2008 at 01:17:20PM -0300, Clodoaldo wrote:
&gt; When inserting into a table and there are many columns to be inserted
&gt; it is hard to synchronize columns to values:

&lt;snip&gt;

&gt; Is there some reason for the insert syntax to be the way it is in
&gt; instead of the much easier to get it right Update syntax?:

Because it's what the SQL standard says. If you don't like it I suggest
you take it up with them... But it's a little late to change now I
think.
</pre>
</blockquote>
<pre wrap=""><!---->
I know about the standards and I'm not blaming postgresql. I just want
to know if it is worth to bring the the matter to some responsible
group.

Regards, Clodoaldo Pinto Neto

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

</pre>
</blockquote>
<br>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 1.9 KB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scara Maccai 2008-02-29 16:57:11 Re: partitioning using dblink
Previous Message Alvaro Herrera 2008-02-29 16:51:30 Re: errors in pg_restore on windows?