Re: Mislabeled timestamp functions (was Re: [SQL] [NOVICE] date_trunc'd timestamp index possible?)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Bruno Wolff III <bruno(at)wolff(dot)to>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Mislabeled timestamp functions (was Re: [SQL] [NOVICE] date_trunc'd timestamp index possible?)
Date: 2004-10-02 18:22:50
Message-ID: 22070.1096741370@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-novice pgsql-sql

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Tom Lane wrote:
>> What I'm inclined to do with these is change pg_proc.h but not force
>> an initdb. Does anyone want to argue for an initdb to force it to be
>> fixed in 8.0? We've lived with the wrong labelings for some time now
>> without noticing, so it doesn't seem like a serious enough bug to
>> force a post-beta initdb ... to me anyway.

> I'd prefer if all users of 8.0 were guaranteed to have the same catalog.

Well, there's something to be said for that viewpoint too. Anyone else
feel the same?

If we do go for an initdb, I'd like at the same time to do something
I had intended to do but forgotten, which is to yank the functions
and operators for basic arithmetic on type "char", and instead put in
(explicit) conversions between "char" and integer. See for instance
http://archives.postgresql.org/pgsql-sql/2002-11/msg00116.php
http://archives.postgresql.org/pgsql-general/2004-08/msg01562.php
http://archives.postgresql.org/pgsql-general/2004-09/msg01209.php

Specifically I want to remove these operators:

oid | oid | oprresult
-----+-------------------+-----------
635 | +("char","char") | "char"
636 | -("char","char") | "char"
637 | *("char","char") | "char"
638 | /("char","char") | "char"

and their underlying functions:

oid | oid | prorettype | prosrc
------+--------------------------+------------+-------------
1248 | charpl("char","char") | "char" | charpl
1250 | charmi("char","char") | "char" | charmi
77 | charmul("char","char") | "char" | charmul
78 | chardiv("char","char") | "char" | chardiv

The following operators on "char" will remain:

oid | oid | oprresult
-----+-------------------+-----------
92 | =("char","char") | boolean
630 | <>("char","char") | boolean
631 | <("char","char") | boolean
632 | <=("char","char") | boolean
633 | >("char","char") | boolean
634 | >=("char","char") | boolean

These are not as dangerous as the arithmetic operators, because in a
situation where the parser is having difficulty resolving types, it
will prefer the "text" comparison operators over these. The reason
the "char" arithmetic operators are dangerous is that they are the only
ones of those names in the STRING type category.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2004-10-02 18:30:22 Re: SQL-Invoked Procedures for 8.1
Previous Message Tom Lane 2004-10-02 17:57:24 Re: SQL-Invoked Procedures for 8.1

Browse pgsql-novice by date

  From Date Subject
Next Message Bruno Wolff III 2004-10-02 20:04:51 Re: Mislabeled timestamp functions (was Re: [SQL] [NOVICE] date_trunc'd
Previous Message Peter Eisentraut 2004-10-02 17:41:29 Re: Mislabeled timestamp functions (was Re: [SQL] [NOVICE] date_trunc'd timestamp index possible?)

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2004-10-02 20:04:51 Re: Mislabeled timestamp functions (was Re: [SQL] [NOVICE] date_trunc'd
Previous Message Peter Eisentraut 2004-10-02 17:41:29 Re: Mislabeled timestamp functions (was Re: [SQL] [NOVICE] date_trunc'd timestamp index possible?)