Re: [SQL] Equivalent to sql%rowcount or @@rowcount

2003-07-25 Thread Richard Huxton
On Friday 25 July 2003 07:04, vijaykumar M wrote: > Hi All! > is it possible to get in sql number of rows affected by the sql last insert, > > update or delete statement?? > > for eg, > > oracle - sql%rowcount. > sqlserver select @@rowcount. You can do this sort of thi

[SQL] [OT] Frontend recommendations

2003-07-25 Thread ries
Hey postgresql gurus, I was just wondering, what kind of frontend do you recommend in 'bills (windows...)' environment? Is it better to use a tool like Qt from trolltech or is it better to use something like Omnis or Access??? What are you opinions best regards, Ries van Twisk --

Re: [SQL] Problem using Subselect results

2003-07-25 Thread oheinz
Quoting Dmitry Tkach <[EMAIL PROTECTED]>: > What about: > > CREATE VIEW my_view AS SELECT b,c from > (SELECT a, b FROM table1 WHERE b=1) as my_ab, > (SELECT a, c FROM table2) as my_ac WHERE my_ac.a=my_ab.a > > This looks like what you are trying to do, and doesn't use that > 'subsubselect' you w

Re: [SQL] [OT] Frontend recommendations

2003-07-25 Thread Richard Huxton
On Friday 25 July 2003 09:18, [EMAIL PROTECTED] wrote: > Hey postgresql gurus, > > I was just wondering, what kind of frontend do you recommend in 'bills > (windows...)' environment? > Is it better to use a tool like Qt from trolltech or is it better to use > something like Omnis or Access??? I've

Re: [SQL] [OT] Frontend recommendations

2003-07-25 Thread Peter Childs
On Fri, 25 Jul 2003 [EMAIL PROTECTED] wrote: > Hey postgresql gurus, > > I was just wondering, what kind of frontend do you recommend in 'bills > (windows...)' environment? > Is it better to use a tool like Qt from trolltech or is it better to use > something like Omnis or Access??? > > What are

Re: [SQL] Problem using Subselect results

2003-07-25 Thread Tom Lane
[EMAIL PROTECTED] writes: > Quoting Dmitry Tkach <[EMAIL PROTECTED]>: >> CREATE VIEW my_view AS SELECT b,c from >> (SELECT a, b FROM table1 WHERE b=1) as my_ab, >> (SELECT a, c FROM table2) as my_ac WHERE my_ac.a=my_ab.a > I assume that with this statement postgresql will compute both subselects,

Re: [SQL] Problem using Subselect results

2003-07-25 Thread Dmitry Tkach
[EMAIL PROTECTED] wrote: Quoting Dmitry Tkach <[EMAIL PROTECTED]>: What about: CREATE VIEW my_view AS SELECT b,c from (SELECT a, b FROM table1 WHERE b=1) as my_ab, (SELECT a, c FROM table2) as my_ac WHERE my_ac.a=my_ab.a This looks like what you are trying to do, and doesn't use that 'subs

[SQL] locks and variable substitution

2003-07-25 Thread gack
Is it possible to do variable substitution with explicit locks in plpgsql? Something along the lines of ... declare big_string alias for $1; excl_table text; begin --assuming big_string starts with something like table=table1! excl_table := substr(big_string,7,(position(''!'' in big_string)-7))

Re: [SQL] ERROR: DefineIndex: index function must be marked iscachable

2003-07-25 Thread Tomasz Myrta
Dnia 2003-07-25 21:09, Użytkownik Elielson Fontanezi napisał: Hi all! What can I do in this case? I could not found anything about iscachable. postgres$ cat in.sql create index bt_proposta_f01 on proposta using btree (func_cod_secretaria(nr_proponente)); postgres$ psql -d escola -f in.

Re: [SQL] locks and variable substitution

2003-07-25 Thread Eric Clark
On Fri, 2003-07-25 at 11:49, [EMAIL PROTECTED] wrote: > > lock table excl_table in exclusive mode; That probably wont work, but this will: EXECUTE ''LOCK TABLE '' || quote_ident(excl_table) || '' IN EXCLUSIVE MODE''; Eric ---(end of broadcast)--

[SQL] Odd problems with create rule

2003-07-25 Thread Jamie Lawrence
Hi all - I'm having a strange problem creating a rule on a view. I've done this with no problem in other databases... I'm wondering if somehow there was something omitted or some other type of prolem with the database creation. Or, I could have no idea what I'm talking about. Any guesses? dlm=

Re: [SQL] Odd problems with create rule

2003-07-25 Thread Tomasz Myrta
Dnia 2003-07-25 23:38, Użytkownik Jamie Lawrence napisał: Hi all - I'm having a strange problem creating a rule on a view. I've done this with no problem in other databases... I'm wondering if somehow there was something omitted or some other type of prolem with the database creation. Or, I coul

Re: [SQL] Odd problems with create rule

2003-07-25 Thread Jamie Lawrence
On Fri, 25 Jul 2003, Tomasz Myrta wrote: > Dnia 2003-07-25 23:38, U?ytkownik Jamie Lawrence napisa?: > >dlm(# values ( > >dlm(# new.projects._id, > ^ > >dlm(# new.doc_num, > >dlm(#

[SQL] Query analyse

2003-07-25 Thread Elielson Fontanezi
Good morning!       First of all, my envoronment is:     Linux netlab142.prodam 2.4.8-26mdk #1 Sun Sep 23 17:06:39 CEST 2001 i686 unknown    pg_ctl (PostgreSQL) 7.2.1       I would like some suggestions on how to speed up a query.       Both of the queries below are identical exce

Re: [SQL] [GENERAL] Query analyse

2003-07-25 Thread Stephan Szabo
On Fri, 25 Jul 2003, Elielson Fontanezi wrote: > First of all, my envoronment is: > Linux netlab142.prodam 2.4.8-26mdk #1 Sun Sep 23 17:06:39 CEST 2001 > i686 unknown > pg_ctl (PostgreSQL) 7.2.1 > > I would like some suggestions on how to speed up a query. > > Both of t

Re: [SQL] [GENERAL] Query analyse

2003-07-25 Thread Dmitry Tkach
The first query is able to use the index on nr_proponente, because the condition involves that column directly, the second query is not, because the index only contains the values of nt_proponente, not results of trunc(..)/ Try replacing that condition with something like pa.nr_proponente B

[SQL] ERROR: DefineIndex: index function must be marked iscachable

2003-07-25 Thread Elielson Fontanezi
Hi all!       What can I do in this case?     I could not found anything about iscachable.   postgres$ cat in.sqlcreate index bt_proposta_f01 on propostausing btree (func_cod_secretaria(nr_proponente)); postgres$ psql -d escola -f in.sqlpsql:in.sql:2: ERROR:  DefineIndex: index function m

Re: [SQL] ERROR: DefineIndex: index function must be marked iscachable

2003-07-25 Thread Stephan Szabo
On Fri, 25 Jul 2003, Elielson Fontanezi wrote: > What can I do in this case? > I could not found anything about iscachable. > > postgres$ cat in.sql > create index bt_proposta_f01 on proposta > using btree (func_cod_secretaria(nr_proponente)); > > postgres$ psql -d escola -f in.sql > psq

RES: [GENERAL] [SQL] ERROR: DefineIndex: index function must be marked iscachable

2003-07-25 Thread Elielson Fontanezi
Oh sorry! Linux netlab142.prodam 2.4.8-26mdk #1 Sun Sep 23 17:06:39 CEST 2001 i686 unknown pg_ctl (PostgreSQL) 7.2.1 -Mensagem original- De: Stephan Szabo [mailto:[EMAIL PROTECTED] Enviada em: sexta-feira, 25 de julho de 2003 16:25 Para: Elielson Fontanezi Cc: pgsql-genera

Re: [GENERAL] [SQL] ERROR: DefineIndex: index function must be

2003-07-25 Thread Stephan Szabo
On Fri, 25 Jul 2003, Stephan Szabo wrote: > On Fri, 25 Jul 2003, Elielson Fontanezi wrote: > > > What can I do in this case? > > I could not found anything about iscachable. > > > > > > postgres$ cat in.sql > > create index bt_proposta_f01 on proposta > > using btree (func_cod_secretaria(n

Re: [SQL] [GENERAL] Query analyse

2003-07-25 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > You're probably ending up with different plans since in one case it has > a plain column reference and in the other it has a marginally complicated > expression in the join condition. Yeah. 7.3 and before cannot do merge or hash joins on conditions that

[SQL] ERROR: DefineIndex: index function must be marked iscachable

2003-07-25 Thread Elielson Fontanezi
Hi!       Who can help me on that?       First of all, my envoronment is:     Linux netlab142.prodam 2.4.8-26mdk #1 Sun Sep 23 17:06:39 CEST 2001 i686 unknown    pg_ctl (PostgreSQL) 7.2.       Problem: ERROR:  DefineIndex: index function must be marked iscachable by executing:   c

Re: [SQL] [GENERAL] ERROR: DefineIndex: index function must be marked

2003-07-25 Thread Stephan Szabo
On Fri, 25 Jul 2003, Elielson Fontanezi wrote: > Who can help me on that? > > First of all, my envoronment is: > Linux netlab142.prodam 2.4.8-26mdk #1 Sun Sep 23 17:06:39 CEST 2001 > i686 unknown > pg_ctl (PostgreSQL) 7.2. You should definately move to the highest 7.2 rel

[SQL] RES: [GENERAL] ERROR: DefineIndex: index function must be marked iscachable

2003-07-25 Thread Elielson Fontanezi
Thanks a lot! The complete solution is here! 1st. The function wich substitute the trunc() function CREATE OR REPLACE FUNCTION func_cod_secretaria(INTEGER) RETURNS INTEGER AS ' DECLARE v_nr_proponente ALIAS FOR $1; BEGIN return TRUNC(v_nr_proponente/10,0)*10; END; '

Re: [SQL] [GENERAL] Function index qeustion

2003-07-25 Thread Tom Lane
Jonathan Bartlett <[EMAIL PROTECTED]> writes: > 1) If you have an index on a cacheable function, does PostgreSQL use the > index instead of calculating the results? Not in general --- only for an indexscan lookup. > 2) How does PostgreSQL know when to recompute the function? Never. That's what