Rewriting select statements

From: "Phil Cairns" <phil(at)pagaros(dot)com(dot)au>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Rewriting select statements
Date: 2009-10-30 20:07:16
Message-ID: 01e301ca599c$95148280$bf3d8780$@com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I want to have the server do this:

If the query has no where clause, use a where clause of "where 1=0".

Is this possible?

Why would I want to do this? Because a third party library (ArcGIS) has a
"feature" such that when a relation name is registered with it, it does a
"select * from <relation>" and then does nothing with the results. It looks
like it's just checking the field names or the fact that the relation
exists. In this case, it's selecting a view that joins 14 tables. The main
table has 350,000 rows, and some of the subsidiary tables have up to 1.5
million rows. This view is not queried without a where clause during the
normal execution of the program, so to save between 6 and 20 minutes of
startup time depending on server load, I'd like to be able to add the where
clause.

Thanks for any help,
Phil Cairns.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Bailey 2009-10-30 20:09:30 Re: Absolute value of intervals
Previous Message Paul Nickerson 2009-10-30 20:06:42 When was a Function Added?