Re: [SQL] Insane behaviour in 8.3.3

2012-06-15 Thread Robert Edwards
On 14/06/12 18:39, Achilleas Mantzios wrote: dynacom=# SELECT id from items_tmp WHERE id=1261319 AND xid=currval('xadmin_xid_seq'); id (0 rows) dynacom=# -- THIS IS INSANE Have you tried: SELECT id from items_tmp WHERE id=1261319 AND xid=currval('xadmin_xid_seq'::text) or even: SE

Re: [SQL] uniqueness constraint with NULLs

2009-06-29 Thread Robert Edwards
Thanks for all these great ideas! Craig Ringer wrote: On Mon, 2009-06-29 at 15:42 +1000, Robert Edwards wrote: Can anyone suggest a way that I can impose uniqueness on a and b when c is NULL? One way is to add an additional partial index on (a,b): CREATE INDEX bobtest_ab_unique ON bobtest

Re: [SQL] uniqueness constraint with NULLs

2009-06-29 Thread Robert Edwards
A. Kretschmer wrote: In response to Robert Edwards : Can anyone suggest a way that I can impose uniqueness on a and b when c is NULL? Sure, use a functional index: test=# create table bobtest (a int, b int, c int); CREATE TABLE test=*# create unique index idx_bobtest on bobtest(a,b,coalesce

[SQL] uniqueness constraint with NULLs

2009-06-28 Thread Robert Edwards
I have a table with a uniqueness constraint on three columns: # \d bobtest Table "public.bobtest" Column | Type | Modifiers +-+-- id | integer | not null default nextval('bob

Re: [SQL] Problem with pg_connect() in PHP

2008-09-25 Thread Robert Edwards
Looks like you are missing the php_pgsql extension (I assume you are running on a Windows server). On Debian GNU/Linux, it is called php5-pgsql (or php4-pgsql, as appropriate). Not sure what it would be called for Windows, but something similar. Simply enabling it (by uncommenting the line in yo

Re: [SQL] May I have an assistance on CREATE TABLE Command

2008-09-17 Thread Robert Edwards
You could: INSERT INTO REGION VALUES (33, 'New Dar'); UPDATE DISTRICT SET region_id = 33 WHERE region_id = 99; DELETE FROM REGION WHERE region_id = 99; UPDATE REGION SET region_name = 'Dar es Salaam' WHERE region_id = 33; Of course, if there is no uniqueness constraint on region_name then yo

Re: [SQL] accounting schema

2008-02-06 Thread Robert Edwards
Medi Montaseri wrote: Hi, I am learning my way into Accounting and was wondering how Accounting applications are designed. perhaps you could point the way On one hand, accountants talk about a sacret equation A = L + OE (Asset = Libility + Owner Equity) and then under each categories the

Re: [SQL] query to select a linked list

2007-05-09 Thread Robert Edwards
Hi Louis-David, I also have written a forum application using PostgreSQL. My schema has a "threadid" for each posting, which is actually also the "messageid" of the first posting in the thread, but that is irrelevant. I can then just select all messages belonging to that thread. The actual hie

Re: [SQL] hi i am gettin error when i am deleting a function from

2006-09-11 Thread Robert Edwards
Can you give us the actual delete command you are issuing? You need to specify the types of the function arguments when deleting functions, for example: DELETE FUNCTION my_sum (int, int); etc. Cheers, Bob Edwards. Penchalaiah P. wrote: Hi good morning to all…. I created some functions in

Re: [SQL] on connect/on disconnect

2006-09-11 Thread Robert Edwards
Markus Schaber wrote: Hi, Robert, Robert Edwards wrote: (this is my first post to this list...) Welcome here. :-) I am wondering if Postgres, and/or SQL in general, has a facility to run a function at connection set-up time (after a successful connection attempt) and/or at session

Re: [SQL] on connect/on disconnect

2006-09-10 Thread Robert Edwards
rotocol is that this is not allowed. Anyway, I still need to know if running functions during connection setup and tear-down, or change of user, is possible or not. Cheers, Bob Edwards. Aaron Bono wrote: On 9/10/06, *Robert Edwards* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> w

[SQL] on connect/on disconnect

2006-09-10 Thread Robert Edwards
(this is my first post to this list...) I am wondering if Postgres, and/or SQL in general, has a facility to run a function at connection set-up time (after a successful connection attempt) and/or at session completion (or disconnect)? I want to pre-populate a table (actually an INSERT rule on a