Re: [GENERAL] Trigger loop question

2004-03-15 Thread Tom Lane
Mike Nolan <[EMAIL PROTECTED]> writes: >> Actually, I wasn't thinking very clearly. The easiest way to break >> the loop is to avoid updating the other table when OLD.x = NEW.x >> in the trigger's arguments. The other way requires a rather-redundant >> SELECT to see what is in the other table. >

Re: [GENERAL] Trigger loop question

2004-03-15 Thread Mike Nolan
> Actually, I wasn't thinking very clearly. The easiest way to break > the loop is to avoid updating the other table when OLD.x = NEW.x > in the trigger's arguments. The other way requires a rather-redundant > SELECT to see what is in the other table. If I have to update the other table for any

Re: [GENERAL] Trigger loop question

2004-03-15 Thread Tom Lane
Mike Nolan <[EMAIL PROTECTED]> writes: > Yes it does. OK, that means Tom's original suggestion of checking > the other table for the same value before updating it should prevent > an infinite loop, providing that's done from a pair of 'after update' > triggers, using the NEW.column entries in th

Re: [GENERAL] Postmaster won't run as service on Cygwin

2004-03-15 Thread Andreas
Update 2: OK, I've got it narrowed down even further. Don't laugh ! It's the name of the service "postmaster". This line creates a service that won't start. $ cygrunsrv --install postmaster --path /usr/bin/postmaster --args "-D /cygdrive/i/db_data/pgsql_data -i" --dep ipc-daemon2 --termsig INT

Re: [GENERAL] Trigger loop question

2004-03-15 Thread Gregory Wood
Mike Nolan wrote: However, if I update table 'B' and the 2nd trigger fires, that trigger will still see the OLD value if does a query on table 'A', since I think transaction atomic rules require that any updated values aren't made available to the outside world (including other triggers) until th

Re: [GENERAL] Postmaster won't run as service on Cygwin

2004-03-15 Thread Andreas
Update: If I let postgresql put it's data where Cygwin proposes /usr/share/postgresl/data then the service starts as expected. Obviously it's either some hardcoded path in the binaries or I have an permission issue with Windows 2000. I'd bet on the permissions. But if the permissions aren't O

Re: [GENERAL] Trigger loop question

2004-03-15 Thread Mike Nolan
> Mike Nolan <[EMAIL PROTECTED]> writes: > > If I set up an on update trigger for table 'A' that updates the > > corresponding column in table 'B', and one for table 'B' that updates > > the corresponding column in table 'A', does that create an endless loop? > > Yes. > > You could break the lo

Re: [GENERAL] boolean to int

2004-03-15 Thread Alex Satrapa
Pavel Stehule wrote: create or replace function int2bool (integer) returns boolean as ' select case when $1=1 then ''t''::boolean else ''f''::boolean end; ' language sql; I'd do it slightly differently, if only to cater to the principle of least surprise: create or replace function int2bool (int

Re: [GENERAL] PostgeSQL problem (server crashed?)

2004-03-15 Thread Edwin Pauli
Edwin Pauli wrote: I've put a strace on my webspace. http://epauli.dyndns.org/strace I've never used the strace command. I see no crazy things in the strace, is that opinion true? -- Edwin Pauli ---(end of broadcast)--- TIP 9: the planner will ignore

Re: [GENERAL] Question on Opteron performance

2004-03-15 Thread William Yu
Reece Hart wrote: On Wed, 2004-03-10 at 18:23, William Yu wrote: /At this time, only Newisys offers a Quad Opteron box and it carries a hefty premium. (Sun's upcoming 4X machine is a rebadged Newisys machine and it's possible HP's will be also.)/ There are several vendors with quad opterons out

[GENERAL] Postmaster won't run as service on Cygwin

2004-03-15 Thread Andreas
Hi, I installed an postmaster for trainig and developement on my home box. It should run as win 2000 service on cygwin. Cygwin sits in I:\cygwin Data is I:\db_data\psql_data Data folder belongs to the userpostgres.benutzer I (postgres) can start the postmaster on a command line. I can log

[GENERAL] type definitions

2004-03-15 Thread Alexander Cohen
Where in the postgres source code can i find the source that declares all the data types that postgres has? Where does it tell postfgres that these types exist ena d here are there functions? thanks -- Alexander Cohen http://www.toomuchspace.com (819) 348-9237 (819) 432-3443 ---

Re: [GENERAL] Character escape in "CREATE FUNCTION ..."

2004-03-15 Thread Shilong Stanley Yao
Tom Lane wrote: Shilong Stanley Yao <[EMAIL PROTECTED]> writes: I am trying to write a function in Postgresql, which takes 2 floats and returns a box. But seems the nested single-quote in the AS clause prevent $1 and $2 from being expanded. Besides writing a C function instead of a SQL one, is

Re: [GENERAL] PostgeSQL problem (server crashed?)

2004-03-15 Thread Edwin Pauli
Richard Huxton wrote: On Monday 15 March 2004 18:49, Edwin Pauli wrote: There are no Postgres binaries in /usr/local/pgsql, but in /usr/local/bin. Because i've only copied /usr/local/pgsql, the binaries are no changed. If you're binaries work with the old data but not the new, then they are old

Re: [GENERAL] boolean to int

2004-03-15 Thread V i s h a l Kashyap @ [Sai Hertz And Control Systems]
Dear Mage , I'm wondering why pgsql doesn't support boolean typecasts like select true::int; Many client applications including php assign 1 to true and 0 to false This was a issue PHP < 4.2 + < PostgreSQL 7.3.x and supports it till now for backward compatibility -- Best Regards, Vishal Kash

Re: [GENERAL] boolean to int

2004-03-15 Thread Mage
Pavel Stehule wrote: Hello, you can use own cast. I think I have to create an own type too, because I don't want to use typecast in every select. You gave me the idea, thank you. Mage ---(end of broadcast)--- TIP 7: don't forget to i

Re: [GENERAL] Character escape in "CREATE FUNCTION ..."

2004-03-15 Thread Richard Huxton
On Monday 15 March 2004 18:38, Shilong Stanley Yao wrote: > Dear All, > I am trying to write a function in Postgresql, which takes 2 floats and > returns a box. But seems the nested single-quote in the AS clause > prevent $1 and $2 from being expanded. Besides writing a C function > instead of a

Re: [GENERAL] boolean to int

2004-03-15 Thread Pavel Stehule
Hello, you can use own cast. create or replace function int2bool (integer) returns boolean as ' select case when $1=1 then ''t''::boolean else ''f''::boolean end; ' language sql; create or replace function bool2int (boolean) returns integer as ' select case when $1 then 0 else 1 end; ' langua

Re: [GENERAL] returning row numbers in select

2004-03-15 Thread Steve Crawford
On Wednesday 10 March 2004 12:25 pm, Randall Skelton wrote: > Is there a way to return an integer row number for a query? Note > that there may be a large number of rows so I would rather not have > joined selects... Well...if your result has a unique column you can do something like this: ste

[GENERAL] boolean to int

2004-03-15 Thread Mage
Hello, I'm wondering why pgsql doesn't support boolean typecasts like select true::int; Many client applications including php assign 1 to true and 0 to false I see no use of pgsql boolean type with php, I use int2 or integer. Mage ---(end of broadcast)---

Re: [GENERAL] PostgeSQL problem (server crashed?)

2004-03-15 Thread Edwin Pauli
Frank Finner wrote: Seems we have been hunting the wrong bugs in the beginning. Could it be possible that there was a major version update of the database engine (7.2.x -> 7.4.x for example), without a database reload? I have noticed several new "features" for queries, I think, 7.4 is much closer

Re: [GENERAL] Send a variable 123k

2004-03-15 Thread Jeff
On Mar 15, 2004, at 11:57 AM, Edwin Quijada wrote: I need to store a picture into my DB. I am converting this into text Base64 and store it into text field. Everything looked fine but when I did the insert I got an error about pqread() and this was disconnected. Seem a text so big it is not sup

[GENERAL] Character escape in "CREATE FUNCTION ..."

2004-03-15 Thread Shilong Stanley Yao
Dear All, I am trying to write a function in Postgresql, which takes 2 floats and returns a box. But seems the nested single-quote in the AS clause prevent $1 and $2 from being expanded. Besides writing a C function instead of a SQL one, is there any way to solve this problem? Thanks a lot. -S