Re: FWD: tinterval vs interval on pgsql-novice

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Hackers List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: FWD: tinterval vs interval on pgsql-novice
Date: 2000-11-28 16:23:10
Message-ID: 3A23DBEE.BCCCDE5@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-novice

> Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu> writes:
> > select ('today', interval '1 day') OVERLAPS ('yesterday', interval '18
> > hours');
> > (the second one fails). Now that I look, this breakage was introduced in
> > March when "we" expunged operators allowed as identifiers (Tom Lane and
> > I have blood on our hands on this one ;) See gram.y around line 5409.
> I see it does fail, but I'm at a complete loss to understand why,
> especially given that the first case still works. The grammar looks
> perfectly fine AFAICT. Can you explain what's wrong here?

Yes. There is one underlying routine implementing the OVERLAPS operator.
As you might expect, it is called overlaps() in the catalog, has an
entry point of overlaps_timestamp(), and takes four arguments of type
timestamp. The other variants which accept an interval type for the
second and/or fourth arguments are defined in pg_proc.h as SQL
procedures which simply add, say, the first and second arguments to end
up with four timestamp arguments.

The SQL routine explicitly calls overlaps() as a function, which is
currently disallowed.

Here is what I'm planning on doing (already tested, but not committed).
I'm adding some productions to the func_name rule in gram.y to handle
the various "stringy operators" such as LIKE and OVERLAPS. These tokens
will also be allowed in the ColLabel rule (as several are already).

This fixes the immediate problem, and makes LIKE handling more
consistant with other special functions. Comments?

- Thomas

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message The Hermit Hacker 2000-11-28 16:47:39 Re: beta testing version
Previous Message Zeugswetter Andreas SB 2000-11-28 16:19:45 AW: Please advise features in 7.1 (SUMMARY)

Browse pgsql-novice by date

  From Date Subject
Next Message Peter Eisentraut 2000-11-28 17:16:47 Re: Re: FWD: tinterval vs interval on pgsql-novice
Previous Message Tom Lane 2000-11-28 16:14:59 Re: FWD: tinterval vs interval on pgsql-novice