Re: [SQL] oracle v$session equivalent in postgresql

2004-11-05 Thread Ian Barwick
On Fri, 5 Nov 2004 08:27:58 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I'm looking for the equivalent in postgresql to the v$session variables in > Oracle. In particular, I need to convert the following statement: > > select s.program, s.machine into :New.app_name,:New.comp_name fro

Re: [SQL] Simple SQL Question

2004-11-05 Thread Tomasz Myrta
Hi All! In one of my application, I would like to implement incremental fetching. The problem is that I would like to run it from a stateless application server, so I have to tell where to begin fetching data. It is simple for a table which has single column primary key, but causes difficulties (at

Re: [SQL] Simple SQL Question

2004-11-05 Thread Franco Bruno Borghesi
wouldn't it be easier using offset & limit?: you always select from the table with an itemkey,location order by clause. You save the current offset between requests, and for every request you re-execute the query with a different offset. If you still want to go with what you already have, you

[SQL] Simple SQL Question

2004-11-05 Thread Andras Kutrovics
Hi All! In one of my application, I would like to implement incremental fetching. The problem is that I would like to run it from a stateless application server, so I have to tell where to begin fetching data. It is simple for a table which has single column primary key, but causes difficulties (at

Re: [SQL] sql problem

2004-11-05 Thread Achilleus Mantzios
O Flavio Fonseca έγραψε στις Nov 5, 2004 : > Hi, > > I am having a problem with a system I developed using php with postgres. > > Take a look at this: > > Welcome to psql 7.3.2, the PostgreSQL interactive terminal. > NetAdmin=# delete from operador where oplogin = 'ff'; > ERROR: fk_historico

Re: [SQL] Delayed result from another connection

2004-11-05 Thread Tom Lane
=?iso-8859-2?B?U1rbQ1MgR+Fib3I=?= <[EMAIL PROTECTED]> writes: > From: "Tom Lane" <[EMAIL PROTECTED]> >> Yes, because your transaction is working with a database snapshot that >> predates the other transaction run by the separate PHP connection. > Yes, but the snapshot is not constant during a tran

[SQL] oracle v$session equivalent in postgresql

2004-11-05 Thread stuff
I’m looking for the equivalent in postgresql to the v$session variables in Oracle. In particular, I need to convert the following statement:   select s.program, s.machine into :New.app_name,:New.comp_name from v$session s where s.audsid=userenv('SESSIONID');   Any help appreciated

Re: [SQL] Help in stored procedure

2004-11-05 Thread Thomas F.O'Connell
I think you want to be using SELECT INTO rather than assignment for your queries. See http://www.postgresql.org/docs/7.4/static/plpgsql- statements.html#PLPGSQL-STATEMENTS-ASSIGNMENT http://www.postgresql.org/docs/7.4/static/plpgsql- statements.html#PLPGSQL-SELECT-INTO The expression part of

Re: [SQL] Group by and aggregates

2004-11-05 Thread Michael L. Hostbaek
Franco Bruno Borghesi (franco) writes: > If I understand well, you want the highest cmup for each partno, that is > max(cmup) grouped by partno (only). > > SELECT T.partno, T.status, TMP.max_cmup_for_partno, max(T.cmup) AS > max_cmup, sum(T.qty) AS sum_qty > FROM my_table T, (SELECT partno,

[SQL] Help in stored procedure

2004-11-05 Thread Igor Maciel Macaubas
Hi Guys,   I need some help on building the following stored procedure, in PL/PgSQL. If this is not the right place to ask for help in this language, please let me know. Here is what I want to do, my comments in red:   CREATE OR REPLACE FUNCTION discover_nsu(integer) RETURNS integer as 'DECL

[SQL] sql problem

2004-11-05 Thread Flavio Fonseca
Hi, I am having a problem with a system I developed using php with postgres. Take a look at this: Welcome to psql 7.3.2, the PostgreSQL interactive terminal. NetAdmin=# delete from operador where oplogin = 'ff'; ERROR: fk_historicosessao_operador referential integrity violation - key in oper

Re: [SQL] Delayed result from another connection

2004-11-05 Thread SZŰCS Gábor
Dear Tom, Thanks for the explanation, it's more than enough. Some more questions if you don't mind: - Original Message - From: "Tom Lane" <[EMAIL PROTECTED]> Sent: Thursday, November 04, 2004 6:46 PM > =?iso-8859-2?B?U1rbQ1MgR+Fib3I=?= <[EMAIL PROTECTED]> writes: > > The php connects t