Re: [SQL] LEAST and GREATEST functions?

2003-07-02 Thread Josh Berkus
Stefan, > My LEAST function would not work because > my_timestamp_field has a datatype of "timestamp > without time zone", and the TO_TIMESTAMP(...) creates > a "timestamp *with* time zone". I could not find > anything in the documentation about this behavior. I > am running v7.3.2. Just do a:

Re: [SQL] Inquiry From Form [pgsql]

2003-07-02 Thread David Witham
Hi Chris, You need to start a transaction explicitly: Session 1: buns=# begin; BEGIN buns=# create table test_table (col1 int); CREATE TABLE Session 2: buns=# \d test_table Did not find any relation named "test_table". Session 1: buns=# commit; COMMIT Session 2: buns=# \d test_table Tabl

Re: [SQL] need some help with a delete statement

2003-07-02 Thread Matthew Hixson
Thanks for all your help, Scott. A friend of mine whipped out this script which runs a lot faster than trying to use the original query I posted. -M@ begin; create temporary table cart_temp as select distinct a.cart_id, a.cart_cookie from v_carts a, v_cart_contents b where a.cart_id = b.cart

Re: [SQL] LEAST and GREATEST functions?

2003-07-02 Thread Stefan Bill
It's good to hear this kind of discussion going on! I solved my problem (for now) by creating a bunch of overloaded LEAST and GREATEST functions, one for each datatype. They only take two parameters, but that's fine for what we're doing. However, I ran into another, unrelated problem. I created

[SQL] Inquiry From Form [pgsql]

2003-07-02 Thread Chris Schneider
I know this is basic, but couldn\'t find and in a hurry to know the answer. When interfacing with PostgreSQL through PSQL, it appears that DML statements are auto-commited, that is, a change I make in one session is seen from another without the original session issueing a COMMIT. Is this a re

Re: [SQL] Timeout while waiting for a LOCK ...

2003-07-02 Thread Bruce Momjian
Yep, we get asked to do that quite often. Use statement_timeout before the LOCK command. If the timeout happens, the LOCK, and hence transaction will abort. --- The Hermit Hacker wrote: > > Simple (I think) question ... i

[SQL] Timeout while waiting for a LOCK ...

2003-07-02 Thread The Hermit Hacker
Simple (I think) question ... is there a way of having an application attempt to acquire a LOCK on a table *without* it blocking? Right now, if you try to LOCK a table that another process has LOCKed, it will hang indefinitely waiting for the other LOCK to drop ... is there a way of setting a 'ti

Re: [SQL] plpgsql - how can I use TG_OP ?

2003-07-02 Thread Ian Barwick
On Wednesday 02 July 2003 18:49, Andreas Schmitz wrote: > Hello *, > > I have a litlle problem writing a plpgsql trigger function. I am in need to > get some interpretaion of the TG_OP within an IF clause to decide with > action will be taken. I tried it that way: > > IF (TG_OP=DELETE AND

[SQL] plpgsql - how can I use TG_OP ?

2003-07-02 Thread Andreas Schmitz
Hello *, I have a litlle problem writing a plpgsql trigger function. I am in need to get some interpretaion of the TG_OP within an IF clause to decide with action will be taken. I tried it that way: IF (TG_OP=DELETE AND check_count > 1) THEN UPDATE tipp_team

Re: [SQL] LEAST and GREATEST functions?

2003-07-02 Thread Josh Berkus
Ang, > Any chance of this making it into 7.4's contrib? Maybe with enough > documentation to make it a tutorial for PostgreSQL's user functions? Er, no. Feature freeze was Tuesday. And you haven't submitted a patch yet. > Wow, less reasons to use VIEWs when CREATE FUNCTION can be just as fast,

Re: [SQL] LEAST and GREATEST functions?

2003-07-02 Thread Joe Conway
Ang Chin Han wrote: Tom Lane wrote: create function greatest(anyelement, anyelement) returns anyelement as 'select case when $1>$2 then $1 else $2 end' language sql; Any chance of this making it into 7.4's contrib? Maybe with enough documentation to make it a tutorial for PostgreSQL's user functi

Re: [SQL] SEQUENCE and PRIMARY KEY

2003-07-02 Thread Rod Taylor
On Wed, 2003-07-02 at 11:30, Ralf Werny wrote: > Hi, > many clients like webmin and openoffice makes an > INSERT NULL if i give no value for a field because it is a sequence. > Is there a better way to solve this problem as using a trigger ? A trigger (maybe a rule) is the way to go about th

[SQL] SEQUENCE and PRIMARY KEY

2003-07-02 Thread Ralf Werny
Hi, many clients like webmin and openoffice makes an INSERT NULL if i give no value for a field because it is a sequence. Is there a better way to solve this problem as using a trigger ? CREATE TABLE test ( id integer PRIMARY KEY ); CREATE SEQUENCE test_seq_id MINVALUE

Re: [SQL] Weird order problem (ignoring whitespaces?)

2003-07-02 Thread scott.marlowe
What locales are the two databases initdb'd to? On Wed, 2 Jul 2003 [EMAIL PROTECTED] wrote: > Hello, > > I used to run a program on a box with postgres 7.1 > There was data like: > 'abc 234' > 'abc 1234' > > (not the extra blank before 234) > > so after a select * from x order by field i got

[SQL] Weird order problem (ignoring whitespaces?)

2003-07-02 Thread g . o . d
Hello, I used to run a program on a box with postgres 7.1 There was data like: 'abc 234' 'abc 1234' (not the extra blank before 234) so after a select * from x order by field i got 'abc 234' 'abc 1234' but since this program runs on a 7.3 postgres version i get. 'abc 1234' 'abc 234' it see

Re: [SQL] Postgres - Delphi Application

2003-07-02 Thread Együd Csaba
Both link work nicely, thanks. I don't know what could be the problem with the others. But it's not important by now Thank you. -- Csaba - Original Message - From: "Tomasz Myrta" <[EMAIL PROTECTED]> To: "Együd Csaba" <[EMAIL PROTECTED]> Sent: Wednesday, July 02, 2003 12:06 PM Subject

Re: [SQL] Getting all rows even if not a member of any groups

2003-07-02 Thread Együd Csaba
Dear All, thank you for your help, it was really efficient. I'll get by with it now. Thanks. -- Csaba - Original Message - From: "Bruno Wolff III" <[EMAIL PROTECTED]> To: "Együd Csaba" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, June 27, 2003 5:10 PM Subject: Re: [SQL] Gett

Re: [SQL] LEAST and GREATEST functions?

2003-07-02 Thread Ang Chin Han
Tom Lane wrote: create function greatest(anyelement, anyelement) returns anyelement as 'select case when $1>$2 then $1 else $2 end' language sql; Any chance of this making it into 7.4's contrib? Maybe with enough documentation to make it a tutorial for PostgreSQL's user functions? You do have to