LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-10-2005, 11:37 AM   #1
trevelluk
Member
 
Registered: Nov 2003
Location: Bristol, UK
Distribution: Debian Lenny, Gentoo (at work)
Posts: 388

Rep: Reputation: 32
PostgreSQL SELECT rules


Hi, I wonder if someone can help with this problem.

I need to set up a SELECT rule on a PostgreSQL View so that when a SELECT query is run, it doesn't get directly executed. Instead, a function gets run instead. The problem is, this function needs to know the content of the WHERE clause in the original query. Any idea how I can get hold of this in a SELECT rule?
I know that in the other rule types the NEW / OLD syntax can be used, but this doesn't work in SELECT.

To explain further:

The rule I've created is:
Code:
CREATE OR REPLACE RULE ccheslct AS
   ON SELECT TO cache_data
   DO INSTEAD 
SELECT checkcache (trlvlid);
where the view is cache_data.
A query will be run on this in the format SELECT cche FROM cache_data WHERE trlvlid = (a number).

Is there any way I can get the value of the trlvlid passed in to the WHERE clause into the call to the checkcache () function?

I know that I could do this by just calling the function directly from the client application. However, I'm trying to keep changes to the (already existing) system as localised as possible.
 
Old 01-12-2005, 05:05 AM   #2
trevelluk
Member
 
Registered: Nov 2003
Location: Bristol, UK
Distribution: Debian Lenny, Gentoo (at work)
Posts: 388

Original Poster
Rep: Reputation: 32
It's academic now...

Following further work on this system, I've realised I'm going to have to make a load of changes to the client app anyway. So the question's basically academic now.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
select jhon Programming 5 11-01-2005 09:46 PM
Select() did not select my socket thvo Programming 1 05-08-2005 12:20 AM
postgresql -odbc & postgresql-jdbc installation kjsubbu Linux - Software 0 06-19-2003 02:50 AM
what os to select kevinasr Linux - Newbie 2 05-18-2003 06:52 AM
Viruses, ipchains, dynamic rules, rules with regular expressions marktaff Linux - Security 2 09-25-2001 04:01 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration