Re: [SQL] creating variable views

2001-07-07 Thread Tom Lane
"Josh Berkus" <[EMAIL PROTECTED]> writes: >> I don't understand the distinction you're trying to make here. In >> general, a view column that is implemented as a function will give >> the >> optimizer headaches if you refer to it in WHERE --- the simplicity or >> complexity of the function has go

Re: [SQL] creating variable views

2001-07-07 Thread Josh Berkus
Tom, > I don't understand the distinction you're trying to make here. In > general, a view column that is implemented as a function will give > the > optimizer headaches if you refer to it in WHERE --- the simplicity or > complexity of the function has got nothing to do with that AFAICS. OK. I

Re: [SQL] Problem with function & trigger

2001-07-07 Thread Tom Lane
Carlo Vitolo <[EMAIL PROTECTED]> writes: > This does not work. The error is ERROR: pg_atoi: error in "12.00": can't > parse ".00" What PG version are you running? It seems to work fine for me in current sources: regression=# create table magazzino (quantita numeric(10,2), regression(# descrizio

Re: [SQL] creating variable views

2001-07-07 Thread Tom Lane
"Josh Berkus" <[EMAIL PROTECTED]> writes: > All this function does is format output, rather than perform any fancy > manipulation. I find that the Postgres view optimizer has no trouble > with such functions. > More complex functions, like qf_calc_next_invoice_date(VARCHAR) which > calculates a c

Re: [SQL] creating variable views

2001-07-07 Thread Tom Lane
Dado Feigenblatt <[EMAIL PROTECTED]> writes: > One thing that still isn't clear for me is how to implement access level > control on a per row basis. The SQL GRANT/REVOKE stuff doesn't deal with anything finer-grain than tables. The best way I know to cope with a need for row-level read access c

Re: [SQL] Is function atomic?

2001-07-07 Thread Peter Eisentraut
John Hasler writes: > > Do you have any idea when [nested transactions] will [be added]? > > Richard Huxton writes: > > Check the "todo" list in the developers' area on the website - that'll > > show what's planned for 7.2 > > It's listed there: that's why I asked. Is everything on that list pla

Re: [SQL] Is function atomic?

2001-07-07 Thread John Hasler
I wrote: > Do you have any idea when [nested transactions] will [be added]? Richard Huxton writes: > Check the "todo" list in the developers' area on the website - that'll > show what's planned for 7.2 It's listed there: that's why I asked. Is everything on that list planned for 7.2? -- John H

Re: [SQL] Is function atomic?

2001-07-07 Thread Richard Huxton
From: "John Hasler" <[EMAIL PROTECTED]> > Richard Huxton writes: > > All functions take place within a transaction, but since PG doesn't > > support nested transactions yet you can't roll back the effects of a > > nested function. > > Do you have any idea when it will? Check the "todo" list in t

Re: [SQL] view and performance

2001-07-07 Thread Richard Huxton
From: "Wei Weng" <[EMAIL PROTECTED]> > Is there any gain on performance if you choose to create a view over a > very complex query instead of running the query itself directly? I *believe* views are pre-parsed so you gain that time. Can't believe you'd notice much difference either way unless th

[SQL] Problem with function & trigger

2001-07-07 Thread Carlo Vitolo
This does not work. The error is ERROR: pg_atoi: error in "12.00": can't parse ".00" CREATE FUNCTION "togliscar" () RETURNS opaque AS 'BEGIN UPDATE magazzino SET quantita = (SELECT quantita FROM magazzino WHERE descrizione = NEW.descrizione ) - NEW.quantita WHERE descrizione = NEW.descrizione; RE