Re: BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail

From: Farid Zidan <farid(at)zidsoft(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail
Date: 2010-06-04 22:15:09
Message-ID: 4C097AED.4080902@zidsoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hello Kevin,<br>
<br>
<blockquote type="cite">
<pre wrap="">I can't help but wonder why you resist using the standard syntax.
</pre>
</blockquote>
I am using the standard syntax. Single quote in sql denotes a string.
so '2010-04-30 00:00:00' is string literal. That's universal. Now you
want me to use PG-specific timestamps and that's like I said is not
standard/cross-dbms.<br>
<br>
I have just finished testing with Ingre 9.2 and it works there too.
That's 10 DBMSs systems that use single quotes to denote a string
literal and can covert ISO-standard datetime string literal to
timestamp.<br>
<br>
You can't not interpret string literals one way in one statement and
just because user uses the word 'distinct' decide to switch paradigms.
That's not good design or planning. Of course you can decide to do
whatever you want, just do not expect developers to start
special-coding just for PostreSQL because you decide to cast correctly
or not correctly depending on whim.<br>
<br>
Let me reiterate the example, maybe it was too terse and you did not
read it carefully,<br>
<br>
<pre wrap="">create table test_insert (
col1 char(8) not null,
col2 TIMESTAMP not null default CURRENT_TIMESTAMP);
</pre>
&gt;create the test table. No issue.<br>
<br>
<pre wrap="">insert into
test_insert
(col1, col2) values
('a', '2010-04-30 00:00:00');
</pre>
&gt;Works like expected, PG correctly converts standard ISO-datetime
string literal to timestamp. No issue.<br>
<br>
<pre wrap="">insert into test_insert
(col1, col2)
select
'b',
'2010-04-30 00:00:00'
</pre>
&gt;That works too. No issue.<br>
<br>
<pre wrap="">insert into test_insert
(col1, col2)
select <b>distinct</b>
'b',
'2010-04-30 00:00:00'
</pre>
&gt;Does not work. That's a bug.<br>
<br>
Now this not rocket science, it's simple insert statement where we do
not want duplicates inserted. Works on 10 other DBMSs.<br>
<br>
FAA stuff and other is not related to this bug. I would think the FAA
and other organizations want a standard-compliant DBMS system that
knows how to convert a simple ISO-formatted valid string literal to a
timestamp value in more than one variation of sql statement.<br>
<br>
You can ignore this bug report and do whatever you want, just do not
say this is an accepted, standard or desired behavior of the server or
is by design. It's not by design that the error happens it is by faulty
handling of the distinct keyword.<br>
<br>
I think you have all the information you need to debate and resolve
this issue. If you need any other information you can contact me and I
will be happy to oblige.<br>
<br>
Farid<br>
<br>
<br>
On 6/4/2010 5:40 PM, Kevin Grittner wrote:
<blockquote cite="mid:4C092C650200002500032027(at)gw(dot)wicourts(dot)gov"
type="cite">
<pre wrap="">I can't help but wonder why you resist using the standard syntax.
The reason the standard exists is to help those trying to write
portable code, so they don't have to count on the vagaries of
"parallel evolution."
</pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Signature</title>
<meta name="author" content="Farid Z">
<font size="-1"><a href="http://www.zidsoft.com/">www.zidsoft.com</a>
CompareData: &nbsp;</font><font size="-1">compare
and synchronize SQL DBMS data </font><font size="-1">visually </font><font
size="-1">between two databases
using ODBC drivers</font>
</div>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 3.5 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kris Jurka 2010-06-05 01:42:20 Re: Re: BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail
Previous Message Robert Haas 2010-06-04 21:57:12 Re: superuser unable to modify settings of a system table