473,322 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

tinterval operators and functions

Just finding out about the tinterval type (thanks again, Alvaro!), I've
been looking to see what operators and functions are already built-in
to PostgreSQL that involve this type. I thought I'd post this in case
anyone else is interested. The results are at the bottom of the post. I
haven't looked at what they do yet: that's the next step.

That said, I haven't been successful finding which functions accept
tinterval as arguments, though this is probably because I don't know
how to handle where clauses involving arrays, or perhaps its because
the pg_proc.proargtypes attribute is type oid vector and haven't
figured out how to handle that. Any insight appreciated. (Query details
below.)

Here's the query I used to find the operators that involve tinterval:
oprleft, oprright, and oprresult just show where tinterval is found.

geos=# select oprname, 'oprleft' as oprarg
geos-# from pg_catalog.pg_operator, pg_catalog.pg_type
geos-# where typname = 'tinterval' and oprleft = pg_type.oid
geos-# union
geos-# select oprname, 'oprright' as oprarg
geos-# from pg_catalog.pg_operator, pg_catalog.pg_type
geos-# where typname = 'tinterval' and oprleft = pg_type.oid
geos-# union
geos-# select oprname, 'oprresult' as oprarg
geos-# from pg_catalog.pg_operator, pg_catalog.pg_type
geos-# where typname = 'tinterval' and oprleft = pg_type.oid
geos-# order by oprname;

Here's the query I used to find functions that return tinterval.
geos=# select proname, 'rettype' as param
geos-# from pg_catalog.pg_proc, pg_catalog.pg_type
geos-# where typname = 'tinterval' and prorettype = pg_type.oid
geos-# ;
proname | param
---------------+---------
tintervalrecv | rettype
tinterval | rettype
mktinterval | rettype
tintervalin | rettype
(4 rows)

I'd also like to find out which functions accept tinterval as
arguments. Here's the query I tried, including the errors that were
returned.

geos=# select proname, 'argtype' as param
geos-# from pg_catalog.pg_proc, pg_catalog.pg_type
geos-# where typname = 'tinterval' and any(proargtypes) = pg_type.oid;
ERROR: syntax error at or near "any" at character 113
ERROR: syntax error at or near "any" at character 113

Obviously ANY doesn't work here, but I don't know what else would.

Michael Glaesemann
grzm myrealbox com

geos=# select oprname, 'oprleft' as oprarg
geos-# from pg_catalog.pg_operator, pg_catalog.pg_type
geos-# where typname = 'tinterval' and oprleft = pg_type.oid
geos-# union
geos-# select oprname, 'oprright' as oprarg
geos-# from pg_catalog.pg_operator, pg_catalog.pg_type
geos-# where typname = 'tinterval' and oprleft = pg_type.oid
geos-# union
geos-# select oprname, 'oprresult' as oprarg
geos-# from pg_catalog.pg_operator, pg_catalog.pg_type
geos-# where typname = 'tinterval' and oprleft = pg_type.oid
geos-# order by oprname;
oprname | oprarg
---------+-----------
#< | oprresult
#< | oprleft
#< | oprright
#<= | oprresult
#<= | oprleft
#<= | oprright
#<> | oprleft
#<> | oprresult
#<> | oprright
#= | oprresult
#= | oprleft
#= | oprright
#> | oprresult
#> | oprleft
#> | oprright
#>= | oprresult
#>= | oprleft
#>= | oprright
&& | oprleft
&& | oprresult
&& | oprright
< | oprresult
< | oprleft
< | oprright
<< | oprleft
<< | oprresult
<< | oprright
<= | oprresult
<= | oprleft
<= | oprright
<> | oprleft
<> | oprresult
<> | oprright
= | oprresult
= | oprleft
= | oprright
| oprresult
| oprleft
| oprright
= | oprresult
= | oprleft
= | oprright

~= | oprleft
~= | oprresult
~= | oprright
(45 rows)
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 22 '05 #1
2 2498
On Friday 16 January 2004 05:14, Michael Glaesemann wrote:

That said, I haven't been successful finding which functions accept
tinterval as arguments, though this is probably because I don't know
how to handle where clauses involving arrays, or perhaps its because
the pg_proc.proargtypes attribute is type oid vector and haven't
figured out how to handle that. Any insight appreciated. (Query details
below.)


If you know yourself and your enemy...

richardh=# \o tinterval.txt
richardh=# \df
richardh=# \do
richardh=# \q
[richardh@mainbox tmp]$ grep tinterval tinterval.txt
--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 22 '05 #2

On Jan 16, 2004, at 6:46 PM, Richard Huxton wrote:
On Friday 16 January 2004 05:14, Michael Glaesemann wrote:

That said, I haven't been successful finding which functions accept
tinterval as arguments, though this is probably because I don't know
how to handle where clauses involving arrays, or perhaps its because
the pg_proc.proargtypes attribute is type oid vector and haven't
figured out how to handle that. Any insight appreciated. (Query
details
below.)


If you know yourself and your enemy...

richardh=# \o tinterval.txt
richardh=# \df
richardh=# \do
richardh=# \q
[richardh@mainbox tmp]$ grep tinterval tinterval.txt


Works for friends, too, eh? :)
Thanks, Richard!

Michael Glaesemann
grzm myrealbox com
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Zenon | last post by:
Folks, I am having a terrible time overloading operators. I have tried what I thought was the correct way, I tried the cheating (friend declarations), all to no avail. Sorry for posting tons of...
4
by: Michael Klatt | last post by:
I've just encountered a strange situation (at least to me) regarding friend operators and member operators: #include <map> class Key { friend bool operator<(const Key& lhs, const Key& rhs)...
3
by: Nimmi Srivastav | last post by:
There's a rather nondescript book called "Using Borland C++" by Lee and Mark Atkinson (Que Corporation) which presents an excellent discussion of overloaded new and delete operators. I am...
7
by: bberu | last post by:
Hi, I know it is possible to refine operators (like +, -, * or /) on classes. But is it possible on simple types ? ex : If I have a type like : typedef int vector is it possible to redefine a...
8
by: Edward Diener | last post by:
By reuse, I mean a function in an assembly which is called in another assembly. By a mixed-mode function I mean a function whose signature has one or more CLR types and one or more non-CLR...
1
by: riceboy_inc | last post by:
Hello; First time posting and hoping to get some help! I have been going to school for Computer Science for 2+ years now, and am finally getting into some serious courses. I recently had to work...
12
by: sam_cit | last post by:
Hi Everyone, I have few questions on inline functions, when i declare a function as inline, is it for sure that the compiler would replace the function call with the actual body of the function?...
13
by: JohnQ | last post by:
The implementation of classes with virtual functions is conceptually easy to understand: they use vtables. Which begs the question about POD structs: how are they associated with their member...
39
by: vlsidesign | last post by:
Operators seem similar to functions. They both do something to either arguments or operands, but are different in their syntax. Operators seem to be like built-in C functions. It would seem that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.