Re: information_schema.columns changes needed for OLEDB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org, Konstantin Izmailov <kizmailov(at)gmail(dot)com>
Subject: Re: information_schema.columns changes needed for OLEDB
Date: 2009-06-09 18:26:03
Message-ID: 25003.1244571963@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> After gathering that there will probably be some other changes before
> release that will require an initdb (even without catversion bump), and
> after reexamining the issue, I think it's trivial and uncontroversial to
> fix the datetime issues:

For the benefit of anyone else finding this hard to read, I've
reformatted as

*** src/backend/catalog/information_schema.sql.orig Tue Feb 24 11:10:16 2009
--- src/backend/catalog/information_schema.sql Tue Jun 9 14:21:37 2009
***************
*** 160,171 ****
RETURNS NULL ON NULL INPUT
AS
$$SELECT
! CASE WHEN $2 = -1 /* default typmod */
! THEN null
WHEN $1 IN (1083, 1114, 1184, 1266) /* time, timestamp, same + tz */
! THEN $2
WHEN $1 IN (1186) /* interval */
! THEN $2 & 65535
ELSE null
END$$;

--- 160,171 ----
RETURNS NULL ON NULL INPUT
AS
$$SELECT
! CASE WHEN $1 IN (1082) /* date */
! THEN 0
WHEN $1 IN (1083, 1114, 1184, 1266) /* time, timestamp, same + tz */
! THEN CASE WHEN $2 = -1 THEN 6 ELSE $2 END
WHEN $1 IN (1186) /* interval */
! THEN CASE WHEN $2 = -1 THEN 6 ELSE $2 & 65535 END
ELSE null
END$$;

I would suggest coding the inner cases as
CASE WHEN $2 < 0 THEN ...default...
since the general practice in the C code is to treat any negative
value as meaning "unspecified". Otherwise, +1.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-06-09 18:29:35 Re: Not quite a security hole in internal_in
Previous Message Gurjeet Singh 2009-06-09 18:23:44 Re: Not quite a security hole in internal_in