[SQL] Need Help for select

2002-08-12 Thread Andre Schubert
Hi all, i need help to build a select query or plpgsql-fucntion for the following tables. create table a ( id int, name varchar(20) ) create table b ( a_id int, c_id int ) create table c ( b_id int, d_id int ) create table d ( id int, name varchar(20) ) Is it possible to build a select query

[SQL] Calling stored procedures in table constraint checks

2002-08-12 Thread Florian Weimer
I guess I need an example how I can pass an entire row to a stored procedure called in a table constraint check. Is this possible at all? -- Florian Weimer[EMAIL PROTECTED] University of Stuttgart http://CERT.Uni-Stuttgart.DE/people/fw/ RUS-CERT

Re: [SQL] Calling stored procedures in table constraint checks

2002-08-12 Thread Tom Lane
Florian Weimer [EMAIL PROTECTED] writes: I guess I need an example how I can pass an entire row to a stored procedure called in a table constraint check. Is this possible at all? In CVS tip it works to do this: regression=# create function foo(tenk1) returns int as ' regression'# begin

Re: [SQL] Need Help for select

2002-08-12 Thread Ludwig Lim
--- Andre Schubert [EMAIL PROTECTED] wrote: Hi all, i need help to build a select query or plpgsql-fucntion for the following tables. Is it possible to build a select query that selects d.name for each a.name where a.id = b.a_id and d.id = c.d_id and each b.c_id must exist in c.b_id.

[SQL] Is this valid?

2002-08-12 Thread Wei Weng
I am not sure if this is the right mailing list I talk to. Please let me know if I had violated any unwritten rules. :) I have a global variable PGconn* m_pgconn that is the connection handle for connecting to the postgresql database. Can I access/use the handle from multiple threads? Say I have

Re: [SQL] Is this valid?

2002-08-12 Thread Robert Treat
I'm going to ask the crazy question of what language/interface are you using to interact with postgres? Based on my interpretation of your question I'd say that won't break (though one of your queries might fail) but then again I may be totally misreading what you wrote... Robert Treat On Mon,

[SQL] Problems using UPDATE and SUM

2002-08-12 Thread Brian Cawthon
I am having a SUM problem also. Here is what I am trying to do. There are two tables: cust_rfq1_2 and inventory1 cust_rfq1_2 has four columns: rfq_id(int4),qty(int4),part_id (varchar 30),rev (varchar 2) inventory1 has three columns: part_id (varchar 30),rev (varchar 2), qty_instock (int4)

[SQL] Conversion

2002-08-12 Thread Lonh SENG
Hi all, How can I convert from int4 to date time? Regards, Lonh

Re: [SQL] Conversion

2002-08-12 Thread Christopher Kings-Lynne
Is the int4 a UNIX epoch? ie. seconds since 1970? If so, then this will generally work: SELECT CAST(int4field AS abstime); or SELECT int4field::abstime; Chris -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Lonh SENGSent: Tuesday, 13

[SQL] : [SQL] Is this valid?

2002-08-12 Thread Wei Weng
I am using C++ and libpq. Thanks Wei -ÓʼþÔ­¼þ- ·¢¼þÈË: Robert Treat [mailto:[EMAIL PROTECTED]] ·¢ËÍʱ¼ä: Monday, August 12, 2002 8:10 PM ÊÕ¼þÈË: Wei Weng ³­ËÍ: [EMAIL PROTECTED] Ö÷Ìâ: Re: [SQL] Is this valid? I'm going to ask the crazy question of what language/interface are you

Re: [SQL] Is this valid?

2002-08-12 Thread Weiping He
Wei Weng wrote: I am not sure if this is the right mailing list I talk to. Please let me know if I had violated any unwritten rules. :) I have a global variable PGconn* m_pgconn that is the connection handle for connecting to the postgresql database. Can I access/use the handle from multiple

[SQL] Function error

2002-08-12 Thread Sugandha Shah
Hi , I'm porting MS- SQL stored procedure to postgres . I'm getting this error : Error occurred while executing PL/pgSQL function sel_free_disk_spaceline 7 at SQL statementSELECT query has no destination for result data.If you want to discard the results, use PERFORM instead. Here is the