Re: [SQL] relationship/table design question

2003-12-04 Thread Jamie Lawrence
On Tue, 02 Dec 2003, Taylor Lewick wrote: > Hi all, new to postgresql and I have a question about how to lay out my > database. > > I have a database with 4 main tables, organizations, contacts, events, > grants. My thinking here is that organizations can have contacts, sponsor > events, > and sp

Re: [SQL] How Do I Toggle Quoted Identifiers?

2003-12-04 Thread Peter Eisentraut
Google Mike writes: > I'm on PHP 4.2.2 and RedHat 9 with PGSQL. I want to turn quoted > identifiers off with my SQL queries. What SQL statement or .CONF > setting do I need to change so that I can turn quoted identifiers off? There is no setting for that. > For that matter, how do I turn case-se

Re: [SQL] How Do I Toggle Quoted Identifiers?

2003-12-04 Thread Richard Huxton
On Thursday 04 December 2003 19:42, Google Mike wrote: > I'm on PHP 4.2.2 and RedHat 9 with PGSQL. I want to turn quoted > identifiers off with my SQL queries. What SQL statement or .CONF > setting do I need to change so that I can turn quoted identifiers off? Short answer - you don't. Your unders

[SQL] relationship/table design question

2003-12-04 Thread Taylor Lewick
Hi all, new to postgresql and I have a question about how to lay out my database. I have a database with 4 main tables, organizations, contacts, events, grants. My thinking here is that organizations can have contacts, sponsor events, and sponsor grants, so it is what I would call the main table.

Re: [SQL] XML & Postgres Functions

2003-12-04 Thread CoL
hi, zerobearing2 wrote: Hi all- I'm migrating to postgres from the MS SQL Server land, as I can see a great potential with postgres, I was wondering if anyone has experimented or started a project with XML inside user defined functions? I've seen the contrib/xml shipped with the distro, as I see

Re: [SQL] Validity check in to_date?

2003-12-04 Thread CoL
hi, SELECT isfinite(timestamp '123.45.2003'); if this is true, the date is ok, if error, than not :) C. Alexander M. Pravking wrote: I just discovered that to_date() function does not check if supplied date is correct, giving surprising (at least for me) results: fduch=# SELECT to_date('31.11.

[SQL] How Do I Toggle Quoted Identifiers?

2003-12-04 Thread Google Mike
I'm on PHP 4.2.2 and RedHat 9 with PGSQL. I want to turn quoted identifiers off with my SQL queries. What SQL statement or .CONF setting do I need to change so that I can turn quoted identifiers off? Quoted identifiers, as I understand them, are where you must put double quotes around any table or

[SQL] ECPG and User-defined Types.

2003-12-04 Thread Andre Yoshiaki Kashiwabara
Hi, How can i use a user-defined type in ECPG code ? For example: I have the following stored-procedure: CREATE FUNCTION teste(MY_TYPE) RETURNS boolean; where MY_TYPE is: CREATE TYPE MY_TYPE AS (id_person INT8, id_book INT8); Now, i am having problem with: EXEC SQL SELECT teste(:asd); --

Re: [SQL] Trigger plpgsql function, how to test if OLD is set?

2003-12-04 Thread Jeff Kowalczyk
Tomasz Myrta wrote: > You can always check whether your trigger has been fired as insert or > update trigger. > DECLARE old_orderid integer; > BEGIN >if TG_OP=''UPDATE'' then > old_orderid=OLD.orderid; >else > old_orderid=-1; >end if; Thank you, that works well enough. I'

Re: [SQL] Trigger plpgsql function, how to test if OLD is set?

2003-12-04 Thread Tomasz Myrta
Dnia 2003-12-04 19:18, Użytkownik Jeff Kowalczyk napisał: When this trigger runs on INSERT operations, the OLD variable is not yet set, and the trigger function returns an error. Can anyone suggest a more sensible way to check for OLD before including it in my expression, or another shortcut? Thank

Re: [SQL] How do I convert an interval into integer?

2003-12-04 Thread Tomasz Myrta
Dnia 2003-12-04 19:09, Użytkownik Wei Weng napisał: I want to convert an interval (from substraction between two timestamps) into a integer that represents how many seconds that interval has. How do I do that? select extract(epoch from your_interval); Regards, Tomasz Myrta -

[SQL] Trigger plpgsql function, how to test if OLD is set?

2003-12-04 Thread Jeff Kowalczyk
I have a test I need to do in my trigger function to see if a standard set of shipmentcharges exists, if not I insert two rows. IF (SELECT COUNT(orderchargeid) FROM ordercharges WHERE orderid=NEW.orderid OR orderid=OLD.orderid)=0 THEN I added the "OR orderid=OLD.orderid" expression to handle th

[SQL] How do I convert an interval into integer?

2003-12-04 Thread Wei Weng
I want to convert an interval (from substraction between two timestamps) into a integer that represents how many seconds that interval has. How do I do that? I am using postgresql 7.3.1 Thanks Wei ---(end of broadcast)--- TIP 5: Have you chec

Re: [SQL] Help converting Oracle instead of triggers to PostgreSQL

2003-12-04 Thread Clint Stotesbery
Hi Christoph, Thanks for the links but the techdoc links for converting from Oracle to PostgreSQL has 2 links that don't go to their intended targets anymore, one is in the 7.3 docs which is really limited (only covers simple things), and the Ora2Pg one I don't really get that well. As far as u

Re: [SQL] Help converting Oracle instead of triggers to PostgreSQL

2003-12-04 Thread Christoph Haller
> > I have some instead of triggers in Oracle, some update instead of triggers > and some insert instead of triggers. I was thinking that I could maybe use > instead of rules in PostgreSQL to get the same effect. I converted the > instead of trigger in Oracle into a PostgreSQL function below: >