How to define automatic filter condition?

Started by Csaba Együdover 17 years ago5 messagesgeneral
Jump to latest
#1Csaba Együd
csegyud@gmail.com

Hi All,

--PG8.3
--Windows 2k3 SBS

I would like to apply an automatic filter condition to a table. I create a
TEMP table at the beginning of the session to store a value to build up a
filter condition and I would like to apply this condition to every select
statement to a table during the current session.
I know that I could use views but views are read only and I also need Update
and Insert.

Could anybody turn my head to the right direction?

Thank you,

-- Csaba

#2A. Kretschmer
andreas.kretschmer@schollglas.com
In reply to: Csaba Együd (#1)
Re: How to define automatic filter condition?

am Wed, dem 12.11.2008, um 8:08:08 +0100 mailte Csaba Egy�d folgendes:

Hi All,

--PG8.3
--Windows 2k3 SBS

I would like to apply an automatic filter condition to a table. I create a
TEMP table at the beginning of the session to store a value to build up a
filter condition and I would like to apply this condition to every select
statement to a table during the current session.
I know that I could use views but views are read only and I also need Update
and Insert.

You can define RULEs on insert and update on a view to do real
insert/update on the base-table.

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

#3Csaba Együd
csegyud@gmail.com
In reply to: A. Kretschmer (#2)
Re: How to define automatic filter condition?

Andreas,
thank you for your reply. Yes, I know that there is such a mathod but I read
somewhere that it is just a limited way. BTW, I am going to dig into this
more deeper.

A possible solution has come into my minde: does it have any risk to use a
read only view for selects but inserts and updates are performed on the base
table? I mean that I would select data from the view and show that
automatically filtered row set to the user but when she/he inserts or
updates a row the generated query would operate on the real (base) table.

thx,

-- Csaba

""A. Kretschmer"" <andreas.kretschmer@schollglas.com> a k�vetkezoket �rta
�zenet�ben news:20081112075900.GB13765@a-kretschmer.de...

Show quoted text

am Wed, dem 12.11.2008, um 8:08:08 +0100 mailte Csaba Egy�d folgendes:

Hi All,

--PG8.3
--Windows 2k3 SBS

I would like to apply an automatic filter condition to a table. I create
a
TEMP table at the beginning of the session to store a value to build up a
filter condition and I would like to apply this condition to every select
statement to a table during the current session.
I know that I could use views but views are read only and I also need
Update
and Insert.

You can define RULEs on insert and update on a view to do real
insert/update on the base-table.

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4A. Kretschmer
andreas.kretschmer@schollglas.com
In reply to: Csaba Együd (#3)
Re: How to define automatic filter condition?

am Wed, dem 12.11.2008, um 11:10:41 +0100 mailte Csaba Egy�d folgendes:

Andreas,
thank you for your reply. Yes, I know that there is such a mathod but I
read somewhere that it is just a limited way. BTW, I am going to dig into
this more deeper.

A possible solution has come into my minde: does it have any risk to use a
read only view for selects but inserts and updates are performed on the
base table? I mean that I would select data from the view and show that
automatically filtered row set to the user but when she/he inserts or
updates a row the generated query would operate on the real (base) table.

Sure, no problem.

Please avoid top-posting.

Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

#5Csaba Együd
csegyud@gmail.com
In reply to: A. Kretschmer (#4)
Re: How to define automatic filter condition?

Sure, no problem.

Please avoid top-posting.

Regards, Andreas
--

Great, thanks.

-- Csaba