Rewriting select statements - Mailing list pgsql-general

From Phil Cairns
Subject Rewriting select statements
Date
Msg-id 01e301ca599c$95148280$bf3d8780$@com.au
Whole thread Raw
Responses Re: Rewriting select statements
Re: Rewriting select statements
List 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.


pgsql-general by date:

Previous
From: Scott Bailey
Date:
Subject: Re: Absolute value of intervals
Next
From: Tom Lane
Date:
Subject: Re: CREATE TABLE LIKE and SERIAL