Month interval bug
============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================
Your name : Andrew V. Gromozdin
Your email address : ag@df.ru
System Configuration
---------------------
Architecture (example: Intel Pentium) : Intel Pentium
Operating System (example: Linux 2.0.26 ELF) : Linux 2.0.38 ELF
PostgreSQL version (example: PostgreSQL-6.4.2) : PostgreSQL-6.4.2
Compiler used (example: gcc 2.8.0) : gcc 2.7.2.3
Please enter a FULL description of your problem:
------------------------------------------------
QUERY: select '09/01/1999 00:00:01.00 MSD'::datetime +
'1month'::timespan as err
or_date;
error_date
---------------------------------
Fri\ Oct\ 01\ 00:00:01\ 1999\ MSD
(1 row)
QUERY: select '09/01/1999 00:00:01.00 MSD'::datetime +
'2month'::timespan as err
or_date;
error_date
---------------------------------
Sun\ Oct\ 31\ 23:00:01\ 1999\ MSK
(1 row)
QUERY: select '09/01/1999 00:00:01.00 MSD'::datetime +
'3month'::timespan as err
or_date;
error_date
---------------------------------
Tue\ Nov\ 30\ 23:00:01\ 1999\ MSK
(1 row)
QUERY: select '09/01/1999 00:00:01.00 MSD'::datetime +
'4month'::timespan as err
or_date;
error_date
---------------------------------
Fri\ Dec\ 31\ 23:00:01\ 1999\ MSK
(1 row)
QUERY: select '09/01/1999 00:00:01.00 MSD'::datetime +
'5month'::timespan as err
or_date;
error_date
---------------------------------
Mon\ Jan\ 31\ 23:00:01\ 2000\ MSK
(1 row)
Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
run this query from psql
If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------
I think it's because of unnormal defined MONTH interval
--
Sincerely Your
Andrew V. Gromozdin, DataForce ISP, Moscow, Russia
From bouncefilter Fri Oct 1 11:14:21 1999
Received: from bologna.nettuno.it (bologna.nettuno.it [193.43.2.1])
by hub.org (8.9.3/8.9.3) with ESMTP id LAA63542
for <pgsql-general@postgresql.org>; Fri, 1 Oct 1999 11:13:57 -0400 (EDT)
(envelope-from jose@sferacarta.com)
Received: from proxy.sferacarta.com (mail@sfcabop1.nettuno.it
[193.207.10.213])
by bologna.nettuno.it (8.9.3/8.9.3/NETTuno 3.3) with ESMTP id RAA03594;
Fri, 1 Oct 1999 17:13:51 +0200 (MDT)
Received: from rosso.sferacarta.com (sferacarta.com) [10.20.30.5]
by proxy.sferacarta.com with esmtp (Exim 2.05 #1 (Debian))
id 11X69B-0006hC-00; Fri, 1 Oct 1999 17:07:05 +0000
Message-ID: <37F4CFD9.422D4975@sferacarta.com>
Date: Fri, 01 Oct 1999 17:14:33 +0200
From: jose soares <jose@sferacarta.com>
X-Mailer: Mozilla 4.5 [it] (Win95; I)
X-Accept-Language: it
MIME-Version: 1.0
To: Moray McConnachie <moray.mcconnachie@computing-services.oxford.ac.uk>
CC: postgresql-general <pgsql-general@postgresql.org>
Subject: Re: [GENERAL] ODBC-client->Linux-server: datatype boolean not
recognized?
References: <199909301033.MAA06992@mail.neroc.nl>
<37F35BF3.862BC069@sferacarta.com>
<01d101bf0b57$f4aaae70$760e01a3@oucs.ox.ac.uk>
Content-Type: multipart/alternative;
boundary="------------AD610E475538F2F54FD20B97"
--------------AD610E475538F2F54FD20B97
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
oh! this was for old releases, now I'm using the following:
create function MsBool(bool,int4) returns bool as '
declare
bool_int int4;
begin
if $1 is NULL then
return NULL;
end if;
if $1 is TRUE then
if $2 <> 0 then
return TRUE;
end if;
else
if $2 = 0 then
return TRUE;
end if;
end if;
return FALSE;
end;
' language 'plpgsql';
create operator = (
leftarg=bool,
rightarg=int4,
procedure=MsBool,
commutator='=',
negator='!=',
restrict=eqsel,
join=eqjoinsel
);
Moray McConnachie ha scritto:
create function MsAccessBool(bool,int4) returns bool
as '' language 'internal';There is surely something missing here, between the empty single
quotes? When I execute that, I get "There is no internal function
msaccessbool"
--------------AD610E475538F2F54FD20B97
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<tt>oh! this was for old releases, now I'm using the following:</tt><tt></tt>
<p><tt>create function MsBool(bool,int4) returns bool as '</tt>
<br><tt>declare</tt>
<br><tt> bool_int int4;</tt>
<br><tt>begin</tt>
<br><tt> if $1 is NULL then</tt>
<br><tt>
return NULL;</tt>
<br><tt> end if;</tt>
<br><tt> if $1 is TRUE then</tt>
<br><tt>
if $2 <> 0 then</tt>
<br><tt>
return TRUE;</tt>
<br><tt>
end if;</tt>
<br><tt> else</tt>
<br><tt>
if $2 = 0 then</tt>
<br><tt>
return TRUE;</tt>
<br><tt>
end if;</tt>
<br><tt> end if;</tt>
<br><tt> return FALSE;</tt>
<br><tt>end;</tt>
<br><tt>' language 'plpgsql';</tt><tt></tt>
<p><tt>create operator = (</tt>
<br><tt> leftarg=bool,</tt>
<br><tt> rightarg=int4,</tt>
<br><tt> procedure=MsBool,</tt>
<br><tt> commutator='=',</tt>
<br><tt> negator='!=',</tt>
<br><tt> restrict=eqsel,</tt>
<br><tt> join=eqjoinsel</tt>
<br><tt> );</tt>
<br>
<br>
<p>Moray McConnachie ha scritto:
<blockquote TYPE=CITE>>create function MsAccessBool(bool,int4) returns
bool
<br>> as '' language 'internal';
<p>There is surely something missing here, between the empty single
<br>quotes? When I execute that, I get "There is no internal function
<br>msaccessbool"</blockquote>
</html>
--------------AD610E475538F2F54FD20B97--