I'm getting the following error:
ERROR: function pg_catalog.overlaps(timest
SQL state: 42725
Hint: Could not choose a best candidate function. You may need to add explicit type casts.
Main Topics
Browse All TopicsI use the sql code below to find if an existing record exist for the same resource in the same date/time range. So the resource 'Conference Room B' can not be double booked.
There is an existing record on 10/27/2009 from 8:00 - 9:00 am. The below sql is finding a match so as a work around, the user needs to specify 7:30 am - 7:45 to book the room before the existing reservation. So I think this is a more general SQL question. That is, what is the best way to test if an existing resource block of time conflicts with an existing record?
Idealy, I would like the user to specify the true time they need the room, from 7:30 am - 8:00 am.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I kinda inherited this Postgres table and not sure why timezone with be used? We have only one application from one location inserting records. Do I or should I need to change this?
CREATE TABLE plus.tbl_waldo
(
dat_indexno integer NOT NULL DEFAULT nextval('plus.waldo_id1'::
dat_empname character varying(50) NOT NULL,
dat_type character varying(1) NOT NULL,
dat_resource character varying(30),
dat_from timestamp with time zone NOT NULL,
dat_to timestamp with time zone NOT NULL,
dat_note character varying(100),
CONSTRAINT indexno_pkey PRIMARY KEY (dat_indexno)
)
WITH OIDS;
ALTER TABLE plus.tbl_waldo OWNER TO pg_user;
Ya know, I'm wondering if the reason for the double booking problem that just started this week is due to the timezone change. Postgres is running on Linux and I don't think we updated to reflect the new time zone change that kicks in next week, not last week as it use to be.
I just checked the web server that is hosting the application that inserts the records and it's up to date. I'm not a linux person and have to wait on the person to confirm.
To solve the error you are seeing, add 'timestamp' to the overlap call. Otherwise, the overlap function doesn't acknowledge that they are time strings and parse them that way.
As to your second query (about whether you really need time zones in the table): you're right; you probably do not need them. However, whoever designed the database probably thought that they would future-proof the data by recording the time zone; that way, if some other application started either adding or reading data from/for other time zones, it would be ready to cope with that. As to whether to change it or not, if it's working as is and you really aren't jumping through hoops dealing with it, I would leave it alone. It's probably not worth the work to determine if changing the table would break anything, or that your data conversion process would be safe.
Business Accounts
Answer for Membership
by: DrCabbagePosted on 2009-10-26 at 16:54:49ID: 25668177
There's an OVERLAPS operator that does this for you: http://www.postgresql.org/ docs/8.4/i nteractive /functions - datetime. html
The example below assumes that your current datestyle settings recognise those date/time values appropriately)
Select allOpen in new window