Re: [GENERAL] Rule for all the tables in a schema

2013-05-23 Thread Sajeev Mayandi
Thanks. I am using 9.2. So will use serge's method. On 5/22/13 11:53 PM, "Sergey Konoplev" wrote: >On Wed, May 22, 2013 at 11:49 PM, Chris Travers >wrote: >> For pre-9.0, just explicitly create, run, and drop a pl/pgsql function. >> Much easier than a shell script. > >+1, good point. > >-- >Ki

Re: [GENERAL] Rule for all the tables in a schema

2013-05-22 Thread Sergey Konoplev
On Wed, May 22, 2013 at 11:49 PM, Chris Travers wrote: > For pre-9.0, just explicitly create, run, and drop a pl/pgsql function. > Much easier than a shell script. +1, good point. -- Kind regards, Sergey Konoplev PostgreSQL Consultant and DBA Profile: http://www.linkedin.com/in/grayhemp Phone:

Re: [GENERAL] Rule for all the tables in a schema

2013-05-22 Thread Chris Travers
On Wed, May 22, 2013 at 11:13 PM, Sergey Konoplev wrote: > On Wed, May 22, 2013 at 10:34 PM, Sajeev Mayandi > wrote: > > Is there a way, I can say create a rule for all the tables in an schema? > > This will avoid writing complicated functions. > > You can use DO block if your postgres version i

Re: [GENERAL] Rule for all the tables in a schema

2013-05-22 Thread Sergey Konoplev
On Wed, May 22, 2013 at 10:34 PM, Sajeev Mayandi wrote: > Is there a way, I can say create a rule for all the tables in an schema? > This will avoid writing complicated functions. You can use DO block if your postgres version is >=9.0. DO $$ DECLARE _tablename text BEGIN FOR SELECT I