Re: [SQL] question on rules

2003-06-12 Thread Tom Lane
[EMAIL PROTECTED] writes: > i'd like to write an rule which fills out some empty attrs on > insert (w/ data from other given attrs). You'd be better off doing this with a BEFORE INSERT trigger. regards, tom lane ---(end of broadcast)--

[SQL] question on rules

2003-06-12 Thread weigelt
hi folks, i'd like to write an rule which fills out some empty attrs on insert (w/ data from other given attrs). the table structure is: CREATE TABLE foo (start date, duration integer, endtime date); and the rule is: CREATE RULE foo1 AS ON INSERT TO foo WHERE new.endtime = NULL DO INSERT

Re: [SQL] help

2003-06-12 Thread Josh Berkus
Tony, > I've a query which needs too many time ca. 12-15 sec. > how can i get a better perfomance? First of all, please take this to the PGSQL-PERFORMANCE list. Second, see this web page: http://techdocs.postgresql.org/guides/SlowQueryPostingGuidelines > explain select o.id from ioobeject o,dis

Re: [SQL] control structures in plpgsql

2003-06-12 Thread Robert Treat
On Thu, 2003-06-12 at 10:24, Stephan Szabo wrote: > > On 12 Jun 2003, Robert Treat wrote: > > > Does anyone know if there is support for "IF x OR y THEN" syntax in > > plpgsql? The docs just say IF [boolean expression] then. which loosely > > interpreted could allow for an OR, but I couldn't seem

Re: [SQL] Some Questions

2003-06-12 Thread Stephan Szabo
On Thu, 12 Jun 2003, Ludwig Lim wrote: > I would like to ask the following questions: > a) Are foreign key constraint triggers guaranteed to > execute first before any ordinary "BEFORE > INSERT/UPDATE/DELETE" trigger is executed? (This is > assuming that the foreign keys are declared as "NOT

Re: [SQL] control structures in plpgsql

2003-06-12 Thread Stephan Szabo
On 12 Jun 2003, Robert Treat wrote: > Does anyone know if there is support for "IF x OR y THEN" syntax in > plpgsql? The docs just say IF [boolean expression] then. which loosely > interpreted could allow for an OR, but I couldn't seem to get it to > work. TIA, Can you give a full example of wha

[SQL] help

2003-06-12 Thread Tony Simbine
hello, I've a query which needs too many time ca. 12-15 sec. how can i get a better perfomance? my table have less than 2300 rows. thanks in advance tony explain select o.id from ioobeject o,dist_vertron v where macro_lid=1123 and (o.id=v.id) and (o.deleted<>'1') and (o.status='acti

[SQL] control structures in plpgsql

2003-06-12 Thread Robert Treat
Does anyone know if there is support for "IF x OR y THEN" syntax in plpgsql? The docs just say IF [boolean expression] then. which loosely interpreted could allow for an OR, but I couldn't seem to get it to work. TIA, Robert Treat -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

Re: [SQL] (no subject)

2003-06-12 Thread Tom Lane
Achilleus Mantzios <[EMAIL PROTECTED]> writes: > On Thu, 12 Jun 2003, A. Van Hook wrote: >> When updating from 7.2.3 to 7.3.3 we have lost the ability to see the >> passwords in pg_shadow. Is there a way to decrypt the passwords? > But you still can do > ALTER USER foo UNENCRYPTED password 'bar'

Re: [SQL] How to make a IN without a table... ?

2003-06-12 Thread David Pradier
On Thu, Jun 12, 2003 at 02:37:00PM +0200, Christoph Haller wrote: > > > > Like "Tell me how much i spent between the 4th and the 7th og this > month > > ?" uses 4 and 7 as arguments, but need to fetch the datas in the > > database. > > Clear enough ? :-) > Yes. > > > > What do you mean by table fun

Re: [SQL] How to make a IN without a table... ?

2003-06-12 Thread Christoph Haller
> > Like "Tell me how much i spent between the 4th and the 7th og this month > ?" uses 4 and 7 as arguments, but need to fetch the datas in the > database. > Clear enough ? :-) Yes. > > What do you mean by table function ? Table functions are aka SetReturningFunctions. Refer to http://techdocs.pos

Re: [SQL] multiple index search with postgres7.1.3 on solaris 8

2003-06-12 Thread Marco Vezzoli
[EMAIL PROTECTED] wrote: > > On Thu, Jun 12, 2003 at 13:21:01 +0200, > Marco Vezzoli <[EMAIL PROTECTED]> wrote: > > Hi everybody, > > I'm sorry if this topic has already been explained, but the search > > engine at archives.postgresql.org shows me 10 pages of results but > > without any link (!)

Re: [SQL] How to make a IN without a table... ?

2003-06-12 Thread David Pradier
On Thu, Jun 12, 2003 at 02:10:06PM +0200, Christoph Haller wrote: > > > > These values are not taken in a table, but put in directly. > > > > I guess i wasn't clear enough. > > "my_function" here is a function which calculate some results about > some > > datas from the database. > > Example : a fu

[SQL] Some Questions

2003-06-12 Thread Ludwig Lim
Hi: I would like to ask the following questions: a) Are foreign key constraint triggers guaranteed to execute first before any ordinary "BEFORE INSERT/UPDATE/DELETE" trigger is executed? (This is assuming that the foreign keys are declared as "NOT DEFERRABLE") b) Is "varchar" (without upper l

Re: [SQL] How to make a IN without a table... ?

2003-06-12 Thread David Pradier
On Thu, Jun 12, 2003 at 07:09:29AM -0500, Bruno Wolff III wrote: > On Thu, Jun 12, 2003 at 13:50:27 +0200, > David Pradier <[EMAIL PROTECTED]> wrote: > > > > I guess i wasn't clear enough. > > "my_function" here is a function which calculate some results about some > > datas from the database. >

Re: [SQL] How to make a IN without a table... ?

2003-06-12 Thread Christoph Haller
> > > These values are not taken in a table, but put in directly. > > I guess i wasn't clear enough. > "my_function" here is a function which calculate some results about some > datas from the database. > Example : a function which would calculate the sum of the money (which > would be stored in t

Re: [SQL] How to make a IN without a table... ?

2003-06-12 Thread Bruno Wolff III
On Thu, Jun 12, 2003 at 13:50:27 +0200, David Pradier <[EMAIL PROTECTED]> wrote: > > I guess i wasn't clear enough. > "my_function" here is a function which calculate some results about some > datas from the database. > Example : a function which would calculate the sum of the money (which > wou

Re: [SQL] multiple index search with postgres7.1.3 on solaris 8

2003-06-12 Thread Bruno Wolff III
On Thu, Jun 12, 2003 at 13:21:01 +0200, Marco Vezzoli <[EMAIL PROTECTED]> wrote: > Hi everybody, > I'm sorry if this topic has already been explained, but the search > engine at archives.postgresql.org shows me 10 pages of results but > without any link (!). > I'm using postgres 7.1.3 on Solaris

Re: [SQL] How to make a IN without a table... ?

2003-06-12 Thread David Pradier
On Thu, Jun 12, 2003 at 01:16:27PM +0200, Christoph Haller wrote: > > > > i ran today in a problem when doing some (i mean too much for me) > advanced sql... > > > > What i want to do is something like this: > > > > SELECT > > my_var1, > > my_var2, > > my_function(my_var1, my_var2

Re: [SQL] How to make a IN without a table... ?

2003-06-12 Thread Bruno Wolff III
On Thu, Jun 12, 2003 at 11:19:14 +0200, David Pradier <[EMAIL PROTECTED]> wrote: > > In short, i want to calculate the result of the function my_function for > some values of my_var1, cross by some values of my_var2. > These values are not taken in a table, but put in directly. > They are a lot,

Re: [SQL] (no subject)

2003-06-12 Thread Achilleus Mantzios
On Thu, 12 Jun 2003, A. Van Hook wrote: > When updating from 7.2.3 to 7.3.3 we have lost the ability to see the > passwords in pg_shadow. Is there a way to decrypt the passwords? The default case (with md5 method in pg_hba.conf) is encrypted passwds. But you still can do ALTER USER foo UNENCRY

[SQL] (no subject)

2003-06-12 Thread A. Van Hook
When updating from 7.2.3 to 7.3.3 we have lost the ability to see the passwords in pg_shadow. Is there a way to decrypt the passwords? thanks -- A. R. Van Hook Honeywell Federal Manufacturing & Technologies IT System Engineer City of Lake Lotawana MO Mayor ---

[SQL] multiple index search with postgres7.1.3 on solaris 8

2003-06-12 Thread Marco Vezzoli
Hi everybody, I'm sorry if this topic has already been explained, but the search engine at archives.postgresql.org shows me 10 pages of results but without any link (!). I'm using postgres 7.1.3 on Solaris 8; I would like to do some query of this form SELECT * FROM table WHERE (attribute1,attribut

[SQL] subselects - which is faster?

2003-06-12 Thread Cedar Cox
It's been a while since I've done much SQL.. . I'm wondering which of these two queries is faster (both get the same result)? . Which one is more correct? Does it even matter or are they the same? The first one reads easier to me. . What's the difference between "InitPlan" and "SubPlan"? exp

Re: [SQL] How to make a IN without a table... ?

2003-06-12 Thread Christoph Haller
> > i ran today in a problem when doing some (i mean too much for me) advanced sql... > > What i want to do is something like this: > > SELECT > my_var1, > my_var2, > my_function(my_var1, my_var2) > FROM ( > SELECT > '1', > '2', > '3

[SQL] How to make a IN without a table... ?

2003-06-12 Thread David Pradier
Hi everybody, i ran today in a problem when doing some (i mean too much for me) advanced sql... What i want to do is something like this: SELECT my_var1, my_var2, my_function(my_var1, my_var2) FROM ( SELECT '1', '2',