[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 r

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 i

[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, 2

[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) Da

[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, 1

[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 u

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 multip

[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_space line 7 at SQL statementSELECT query has no destination for result data.If you want to discard the results, use PERFORM instead. Here is th

Re: [SQL] Function error

2002-08-12 Thread Janning Vygen
Am Dienstag, 13. August 2002 08:06 schrieb 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_space line 7 at SQL statement > SELECT query has no destination for result data. >

Re: [SQL] Conversion

2002-08-12 Thread Alexander M. Pravking
On Tue, Aug 13, 2002 at 11:32:25AM +0800, Christopher Kings-Lynne wrote: > 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; http://www.postgresql.org/idocs/index.php?datatyp

Re: [SQL] Conversion

2002-08-12 Thread Christopher Kings-Lynne
> On Tue, Aug 13, 2002 at 11:32:25AM +0800, Christopher Kings-Lynne wrote: > > 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; > > http://www.postgresql.org/idoc