Re: [SQL] problem with keyword 'old'
Basilis Kladis wrote: [Charset iso-8859-7 unsupported, filtering to ASCII...] > I am ussing Postgresql v. 6.3 in a RedHat Linux system. I try to create a > rule to log the deletes on table 'filter' ussing the following: First of all, the rule system up to version 6.3 is known to be broken in several ways. And IIRC delete rules where one of the cases that didn't work reliable. To answer your question, in 6.3 the old row is identified by the keyword CURRENT, not OLD. Jan > > CREATE RULE log_delete_filter AS ON DELETE TO filter > DO > INSERT INTO log_activity (mod_table, mod_record, mod_type) > VALUES ('filter', old.did, 'D'); > > The atributes of tables are: > filter (did int4, text text) > log_activity (mod_table char(20), mod_rec int4, mod_type char(1) ) > > I have the following result: > ERROR: old: Table does not exist. > and the rule is not created. > > I tested a same rule on INSERT with the keyword new.did and is working > perfect. > Also I tested the commands: > SELECT new.did; > > ERROR: NEW used in non-rule query > SELECT current.did; > >ERROR: CURRENT used in non-rule query > SELECT old.did; > >ERROR: old: Table does not exist. > > What is going on? Do you have any idea why does system not undestand > keyword 'old'? > > Sincerely, > Basilis Kladis <[EMAIL PROTECTED]> > > ___ __ > Language Engineering Dept. > KNOWLEDGE S.A. > -- #==# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #== [EMAIL PROTECTED] #
[SQL] Access Permissions/Security
Hi, I need to find the query that will return all security access permissions. For example if a INSERT has been granted to a particular user, how do I perform the query which will return this result. I know that the \z command returns this, but I need the raw SQL to do it - any ideas please? Many thanks, Rob. _ Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com
[SQL] FW: Sharing Databases
-Original Message- From: Yoghini Thevarajah [mailto:[EMAIL PROTECTED]] Sent: Monday, November 27, 2000 1:06 PM To: [EMAIL PROTECTED] Subject: FW: Sharing Databases Need help desperately. Is is possible at all to share tables between different databases. In SELECT query need to make join to two tables in different databases. Thanks a million in advance. Yoghini
[SQL] rules on select - different output
Hi, I'd like my rule to change the row which is resulting form select. I'd like to get a row conforming to t1 from t2. CREATE TABLE t1 (id int, f1 int, f2 int, f3 text, f4 text); CREATE TABLE t2 (id int, p1 int, p2 text); CREATE RULE r1 AS ON SELECT TO t2 DO INSTEAD SELECT id, p1 AS f1, NULL::INT AS f2, p2 as f3, NULL::TEXT as f4 FROM t2; psql:test.sql:11: ERROR: select rules target list must match event relations st ructure test=# Is there another way to do it? tia mazek
[HACKERS] Re: [SQL] Rules with Conditions: Bug, or Misunderstanding
Jan Wieck <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> Hm. Perhaps the "cannot update view" test is too strict --- it's not >> bright enough to realize that the two rules together cover all cases, >> so it complains that you *might* be trying to update the view. As the >> code stands, you must provide an unconditional DO INSTEAD rule to >> implement insertion or update of a view. > Disagree. > A conditional rule splits the command into two, one with the > rules action and the condition added, one which is the > original statement plus the negated condition. So there are > cases left where an INSERT can happen to the view relation > and it's the job of this test to prevent it. Well, in that case the present code is broken, because it's going to spit up if any part of the rewritten query shows the view as result relation (cf. QueryRewrite() ... note that this logic no longer looks much like it did the last time you touched it ;-)). You'd have to convert the existing rewrite-time test into a runtime test in order to see whether the query actually tries to insert any tuples into the view. While that is maybe reasonable for insertions, it's totally silly for update and delete queries. Since the view itself can never contain any tuples to be updated or deleted, a runtime test that errors out when one attempts to update or delete such a tuple could never fire. I don't think that means that we shouldn't complain about an update or delete on a view. I think the test is best left as-is... regards, tom lane
[HACKERS] Re: [SQL] Rules with Conditions: Bug, or Misunderstanding
Tom Lane wrote: > "Joel Burton" <[EMAIL PROTECTED]> writes: > > create rule dev_ins as on update to dev_col_comments where > > old.description isnull do instead insert into pg_description ( objoid, > > description) values (old.att_oid, new.description); > > > create rule dev_upd as on update to dev_col_comments where > > old.description notnull do instead update pg_description set > > description=new.description where objoid=old.att_oid; > > > This doesn't work: I get a "cannot update view w/o rule" error > > message, both for fields where description was null, and for fields > > where it wasn't null. > > Hm. Perhaps the "cannot update view" test is too strict --- it's not > bright enough to realize that the two rules together cover all cases, > so it complains that you *might* be trying to update the view. As the > code stands, you must provide an unconditional DO INSTEAD rule to > implement insertion or update of a view. Disagree. A conditional rule splits the command into two, one with the rules action and the condition added, one which is the original statement plus the negated condition. So there are cases left where an INSERT can happen to the view relation and it's the job of this test to prevent it. Jan -- #==# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #== [EMAIL PROTECTED] #
Re: [PHP-DB] Re: [SQL] a script that queries database periodically
Roberto Mello wrote: > > Jason wrote: > > > > aolserver is a web/application server. PHP is a server-side scripting > > language. Why exactly *should* it have a job scheduler? > > > > Some (such as myself) might also ask why should a web server have a job > > scheduler, but that's a thread for a different list :) > > Because PHP is supposed to solve web development problems. And this is > one of them. It's very useful. > > -Roberto > -- > Computer ScienceUtah State University > Space Dynamics Laboratory Web Developer > USU Free Software & GNU/Linux Club http://fslc.usu.edu > My home page - http://www.brasileiro.net/roberto heya, IMHO it depends on why you are querying the db if you need internet access data such as how fast its querying or what have you then yes php could be useful if you need reports generated and mailed to someone a crond shell script would seem more logical
Re: [PHP-DB] Re: [SQL] a script that queries database periodically
On Mon, Nov 27, 2000 at 02:56:59PM -0700, Roberto Mello wrote: > > PHP does not have a scheduling facility? AOLserver (the web/application > server that powers AOL) has had such facility (and many many others for > db-backed websites) since 1995. ns_schedule_proc. > http://www.aolserver.com aolserver is a web/application server. PHP is a server-side scripting language. Why exactly *should* it have a job scheduler? Some (such as myself) might also ask why should a web server have a job scheduler, but that's a thread for a different list :)