Skip site navigation (1) Skip section navigation (2)

Re: 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: Kris Jurka <books(at)ejurka(dot)com>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Re: BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail
Date: 2010-06-05 02:54:15
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <meta content="text/html; charset=ISO-8859-1"
<body bgcolor="#ffffff" text="#000000">
I only use ODBC escape sequences when necessary. Obviously I want to
use standard sql syntax as much as possible. {fn user() } is handy
because it works in all the databases that I work with and there is no
substitute standard sql function for getting current userid that is
I also use {fn now()} which works across most ODBC drivers, but I can't
in this case because I need to use a constant timestamp value so as not
to change distinctness of the subquery that is the source for the
The datetime ISO-standard string format I am using works in all the
databases I use 14+ (including PG), except in this case where
'distinct' is used with subquery in PG.<br>
Also not all PG clients use ODBC, so other PG clients will encounter
this issue using standard ISO datetime string format when not using
ODBC. I don't want to limit users to using ODBC for loading/updating
the database by running sql scripts (which is what the sql for this
issue is used for) so almost all of the database update/load scripts
use generic sql where timestamp/datetime values are are written as ISO
datetime format strings same format as '2010-04-30 00:00:00'<br>
BTW, I have also tested the sql in question with SQLite, MS Access, MS
Excel and Sybase Adaptive Server 15 and it works with no error, so now
that's 14 different DBMSs that have no issue with the ISO standard
string format and distinct keyword.<br>
I guess I can find some workaround for this to work with ODBC just for
the specific sql statements causing errors with PG, but that does not
resolve the issue for PG clients not using ODBC.<br>
Like I said, I am reporting this issue so it can be identified and
hopefully addressed at some point in the future, it is not critical for
me for it to work right now, but that would be nice otherwise user will
see a bunch of one-time errors and lose some ease of use but otherwise
will not be too badly affected.<br>
On 6/4/2010 9:42 PM, Kris Jurka wrote:
On Fri, 4 Jun 2010, Farid Zidan wrote:
  <blockquote type="cite">Here is actual statements I am running and
like I said they work for all 9+
DBMSs (I use ODBC and{fn user()} is the ODBC cross-dbms syntax for the
current user ID):
'2010-04-30 00:00:00',
'2010-04-30 00:00:00',
{fn user() }
If you're into using standard ODBC escapes for portability, shouldn't
you be using {ts '2010-04-30 00:00:00'}?
<a class="moz-txt-link-freetext" href=""></a>
Kris Jurka
<div class="moz-signature">-- <br>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta name="author" content="Farid Z">
<font size="-1"><a href=""></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>

Attachment: unknown_filename
Description: text/html (3.5 KB)

In response to

pgsql-bugs by date

Next:From: Farid ZidanDate: 2010-06-05 03:27:20
Subject: Re: BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail
Previous:From: Greg StarkDate: 2010-06-05 02:41:32
Subject: Re: BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group