Re: [SQL] plpgsql + dblink() question

2003-02-07 Thread Joe Conway
Frankie wrote: The case is when I call a function (from Server 1 at psql prompt) that will call dblink to do some operation on another server(it will take certain time), i.e. Server 2, and meanwhile I just unplug the network cable to Server 2. The consequence is that the function will never return

[SQL] plpgsql + dblink() question

2003-02-07 Thread Frankie
I have a problem with (plpgsql + dblink) function call to another postgresql database server. The case is when I call a function (from Server 1 at psql prompt) that will call dblink to do some operation on another server(it will take certain time), i.e. Server 2, and meanwhile I just unplug the ne

Re: [SQL] Start and End Day of a Week

2003-02-07 Thread Luis Magaña
Hi, I've found my own answer... this is in case somebody needs it someday, it seems that works properly in PG 7.3, one function gives the start of the week and the other one the end: CREATE OR REPLACE FUNCTION weekstart(int4,int4) RETURNS TIMESTAMP AS' DECLARE year ALIAS FOR $1;

[SQL] Start and End Day of a Week

2003-02-07 Thread Luis Magaña
Hi, how can I get the first and last day of a week given the year and the week number ??? example week 3 of 2003 starts in Jan 12th and ends on Jan 18th. how to know the last two values given the year and the number of week ? thanks. Best Regards. -- Luis Magaña. Gnovus Networks & Software

Re: [SQL] bytea

2003-02-07 Thread Steve Crawford
That would be convenient but there are some difficulties. Say you have a function that worked something like: insert.values (, filetobytea("/home/me/myfile"),...); It would be a nice ability to have but the server may not be on the same machine (or even the same type/os/filesystem) as the

[SQL] update column with rowtype

2003-02-07 Thread betty
Hi.. I try "rowtype" in trigger, ex: create or replace function fn_tr_aiu_pdcblc() returns trigger as ' declare c_pdcblc cursor for select * from t_pdcblc where fc_branch=new.fc_branch and fc_bankacct=new.fc_bankacct; balance decimal(30,5); row_pdcblc t_pdcblc%rowtype; begin balance:=

Re: [SQL] "function has no parameter $1" - help.

2003-02-07 Thread Daniel Schuchardt
In > 7.3 you can also CREATE OR REPLACE FUNCTION xxx() RETURNS TRIGGER AS' BEGIN END'LANGUAGE plpgsql; ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] which will be faster? w/ or w/o indices

2003-02-07 Thread Josh Berkus
Val, > Can't really say without testing - it'll depend on the size of the various > tables, X and Y disk speeds etc. The only suggestion I can make is to try > an EXPLAIN (Reference manual, SQL commands) with and without > ENABLE_SEQSCAN off (Admin guide ch 3.2). Please use EXPLAIN ANALYZE instea

Re: [SQL] efficient count/join query

2003-02-07 Thread Tomasz Myrta
Gary Stainburn wrote: On Friday 07 Feb 2003 1:26 pm, Tomasz Myrta wrote: Gary Stainburn wrote: Many appologoes Tomasz. No problem Because your select *LOOKED* wrong to me, I didn't even try it. Upon looking at it again I can see what you're doing. When I tried, it complained about t

Re: [SQL] efficient count/join query

2003-02-07 Thread Gary Stainburn
On Friday 07 Feb 2003 1:26 pm, Tomasz Myrta wrote: > Gary Stainburn wrote: > > On Friday 07 Feb 2003 10:48 am, Tomasz Myrta wrote: > > > > > Hi Tomasz, > > [snip] > > I understood your problem well and I just thought some idea will be enough > to continue work. > > Here is detailed query for your

[SQL] prosgrees + java + trasnacciones

2003-02-07 Thread jose antonio leo
Hola a todos! Intento hacer una aplicacion en java que va contra pgsql y me gustaria bloquear registros. Un jps llama a un metodo de una clase para modificar un registro. Lo primero que hace es una consulta del registro (aquí quiero bloquear el registro) y despues se muestra en el navegador el res

Re: [SQL] efficient count/join query

2003-02-07 Thread Richard Huxton
On Friday 07 Feb 2003 12:57 pm, Gary Stainburn wrote: > > Thinking about it, I'm not wanting to perform a join as such, but a merge > of the two selects below, then some form of group by to sum() the two > counts. > > select rosid as sid, rojid as jid, count(*) as count > from

Re: [SQL] efficient count/join query

2003-02-07 Thread Tomasz Myrta
Gary Stainburn wrote: On Friday 07 Feb 2003 10:48 am, Tomasz Myrta wrote: Hi Tomasz, I don't think you understand what I mean. The history table could be thought of as the following SQL statement if the data had actually existed. This table actually represents a manually input summary of

Re: [SQL] efficient count/join query

2003-02-07 Thread Gary Stainburn
On Friday 07 Feb 2003 12:09 pm, Gary Stainburn wrote: > On Friday 07 Feb 2003 10:48 am, Tomasz Myrta wrote: > > Gary Stainburn wrote: > > > Hi folks, > > > > > > I've got two tables, first a history table containing tallies for > > > staff/jobs prior to going live, and second a roster table showing

Re: [SQL] efficient count/join query

2003-02-07 Thread Gary Stainburn
On Friday 07 Feb 2003 10:48 am, Tomasz Myrta wrote: > Gary Stainburn wrote: > > Hi folks, > > > > I've got two tables, first a history table containing tallies for > > staff/jobs prior to going live, and second a roster table showing date, > > diagram, job with one record per person per job per day

Re: [SQL] conversi ms-sql7 vs postgresql 7.3

2003-02-07 Thread Richard Huxton
On Thursday 06 Feb 2003 10:10 am, betty wrote: > Hi.. > > I have table xx: > id debet credit balance > 1 10000 0 > 2 2000 0 0 > 3 0 2500 0 > 4 0 100 0 > > command in ms-sql 7

Re: [SQL] Lock timeout detection in postgres 7.3.1

2003-02-07 Thread Christoph Haller
> > PostgreSQL 7.3 Documentation > 3.4. Run-time Configuration > STATEMENT_TIMEOUT (integer) > Aborts any statement that takes over the specified number of milliseconds. A value of zero turns off the timer. > DEADLOCK_TIMEOUT (integer) > This is the amount of time, in milliseconds, to wait on a loc

Re: [SQL] efficient count/join query

2003-02-07 Thread Tomasz Myrta
Gary Stainburn wrote: Hi folks, I've got two tables, first a history table containing tallies for staff/jobs prior to going live, and second a roster table showing date, diagram, job with one record per person per job per day. the tables are: create table history ( hsid int4 not null referenc

Re: [SQL] SET TIMEOUT equivalent / was: Lock timeout detection

2003-02-07 Thread Tomasz Myrta
Christoph Haller wrote: Sorry to bother again with my question. Is it too stupid or trivial to this list? Should I send it to NOVICE? Regards, Christoph There are no stupid questions, there are only stupid answers ;-) Anyway - try to not create more threads for the same subject if possible. Re

Re: [SQL] Lock timeout detection in postgres 7.3.1

2003-02-07 Thread Tomasz Myrta
Christoph Haller wrote: Yupp, I agree. But from former DBMS I was dealing with, I know this SET TIMEOUT called feature, which if properly set terminated processes like that hanging on T2. Is there something comparable within Postgres? PostgreSQL 7.3 Documentation 3.4. Run-time Configuration ST

[SQL] efficient count/join query

2003-02-07 Thread Gary Stainburn
Hi folks, I've got two tables, first a history table containing tallies for staff/jobs prior to going live, and second a roster table showing date, diagram, job with one record per person per job per day. the tables are: create table history ( hsidint4 not null references staff(sid), hjid

Re: [SQL] conversi ms-sql7 vs postgresql 7.3

2003-02-07 Thread Christoph Haller
> > I have table xx: > id debet credit balance > 1 10000 0 > 2 2000 0 0 > 3 0 2500 0 > 4 0 100 0 > > command in ms-sql 7 can use calculate field (column) balance from id=1 to

Re: [SQL] which will be faster? w/ or w/o indices

2003-02-07 Thread dev
> I understand that if you are importing data into the database > that this will go faster if there are no indices against the > target table. > > If I want to run this statement: > INSERT INTO table_a SELECT * from table_b WHERE value_1 BETWEEN > X AND Y; > is it best to do that with or without in

[SQL] SET TIMEOUT equivalent / was: Lock timeout detection

2003-02-07 Thread Christoph Haller
> > > > > > > T1 (within psql): > > > BEGIN; DELETE FROM ; > > > DELETE n > > > > > > T2 (within psql): > > > BEGIN; DELETE FROM ; > > > > > > > ... > > > >I don't think there is a deadlock in the example > > given above. If I'm not mistaken a deadlock occurs if > > both transactions are wai

Re: [SQL] PostgreSQL 7.3.1 multiple schema select query error:

2003-02-07 Thread Achilleus Mantzios
On Fri, 7 Feb 2003, waimeng wrote: The Exception is thrown in public java.sql.ResultSet execute() method of QueryExecutor.java This method implements the native protocol of postgres server/client communication. So, the message is actually from the backend. See line 104: errorMessage.append(pg_st

[SQL] which will be faster? w/ or w/o indices

2003-02-07 Thread val
I understand that if you are importing data into the database that this will go faster if there are no indices against the target table. If I want to run this statement: INSERT INTO table_a SELECT * from table_b WHERE value_1 BETWEEN X AND Y; is it best to do that with or without indices? AND,

Re: [SQL] "function has no parameter $1" - help.

2003-02-07 Thread Christoph Haller
> > I'm trying to create a trigger to enforce a constraint onto two possible > foreign tables > my function is defined as: > > <-- snip --> > CREATE OR REPLACE FUNCTION > sp_check_tranitem_productid(tbl_tranitem.fld_tranitem_id%TYPE, > tbl_tranitem.fld_tranitem_type%TY

[SQL] PostgreSQL 7.3.1 multiple schema select query error: java.sql.SQLException: ERROR: parser: parse error at or near "."

2003-02-07 Thread waimeng
I am using postgresql 7.3.1 on windows 2000. I downloaded the lattest postgres jdbc driver for version 7.3.1, called pg73jdbc3.jar and using JBoss-3.04_Tomcat-4.0.6. I created one database called 'testdb', and a scheme called 'sc_test', with a table called 'tbl_company' under the sc_test scheme.

[SQL] "function has no parameter $1" - help.

2003-02-07 Thread Michael Weaver
Title: "function has no parameter $1" - help. I'm trying to create a trigger to enforce a constraint onto two possible foreign tables my function is defined as: <-- snip --> CREATE OR REPLACE FUNCTION sp_check_tranitem_productid(tbl_tranitem.fld_tranitem_id%TYPE,            

[SQL] PostgreSQL 7.3.1 multiple schema select query error: java.sql.SQLException: ERROR: parser: parse error at or near "."

2003-02-07 Thread waimeng
I am using postgresql 7.3.1 on windows 2000. I downloaded the lattest postgres jdbc driverfor version 7.3.1, called pg73jdbc3.jar and using JBoss-3.04_Tomcat-4.0.6.   I created one database called 'testdb', and a scheme called 'sc_test', with a table called 'tbl_company' under the sc_test sc