Re: [GENERAL] most idiomatic way to "update or insert"?

2004-08-05 Thread Ron St-Pierre
Greg Stark wrote: Ron St-Pierre <[EMAIL PROTECTED]> writes: BTW these updates do take longer than we'd like so I would appreciate more input on how this setup could be redesigned. Where is the input coming from? One option is to batch changes. Something like update current_stock_price

Re: [GENERAL] most idiomatic way to "update or insert"?

2004-08-05 Thread Matteo Beccati
Hi, I prefer to update and if the number of updated rows equals 0 do an insert. So in case of update I need only one roundtrip. If insert is far more common in this case it might be better try insert and catch the error. But I try to avoid running on an error intentionally. When logging to a compa

Re: [GENERAL] Sequence Question

2004-08-05 Thread Oscar Tuscon
I'm not sure but I don't think that's safe since nextval doesn't lock the sequence until the setval occurs. Though it might be unlikely to actually occur in real life. You could create a table with as many entries as you will ever need and then select nextval() from that table and read all the

Re: [GENERAL] Correct escaping of untrusted data

2004-08-05 Thread Geoff Caplan
Tom, Belated thanks for the info (I've been away from my desk). Very helpful. -- Geoff Caplan Vario Software Ltd (+44) 121-515 1154 ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings

Re: [GENERAL] most idiomatic way to "update or insert"?

2004-08-05 Thread Richard Huxton
Ron St-Pierre wrote: Okay, this simple example really exists, but the simple table also includes a date that the stock was last traded, so we have: stock symbol, stock exchange, high, low, open, close, volume, date, plus a few more fields [snip more details] BTW these updates do take longer than

Re: [GENERAL] most idiomatic way to "update or insert"?

2004-08-05 Thread Greg Stark
Ron St-Pierre <[EMAIL PROTECTED]> writes: > BTW these updates do take longer than we'd like so I would appreciate more > input on how this setup could be redesigned. Where is the input coming from? One option is to batch changes. If you just insert into a log table whenever new data is availabl

Re: [GENERAL] trash talk

2004-08-05 Thread Greg Stark
"Scott Marlowe" <[EMAIL PROTECTED]> writes: > This is less than a year after the last major release, 7.3.0 by the way. Uhm. Wasn't 7.4 the last major release? -- greg ---(end of broadcast)--- TIP 6: Have you searched our list archives?

Re: [GENERAL] most idiomatic way to "update or insert"?

2004-08-05 Thread Ron St-Pierre
Richard Huxton wrote: Ron St-Pierre wrote: Richard Huxton wrote: An "update or insert" would be useful sometimes, but it's not always necessary. Indeed, if I find I don't know whether I'm adding or updating something I take a long hard look at my design - it ususally means I've not thought clear

Re: [GENERAL] most idiomatic way to "update or insert"?

2004-08-05 Thread Richard Huxton
Ron St-Pierre wrote: Richard Huxton wrote: An "update or insert" would be useful sometimes, but it's not always necessary. Indeed, if I find I don't know whether I'm adding or updating something I take a long hard look at my design - it ususally means I've not thought clearly about something. C

Re: [GENERAL] case insensitive sorting & searching in oracle 10g

2004-08-05 Thread Pierre-Frédéric Caillaud
IMHO, no on both questions. There's always danger on relying on the value of session variables in general in that an application must either And what if you use a connection sharing/pooling software ? What happens with the session vars ? ---(end of broadcast)--

Re: [GENERAL] case insensitive sorting & searching in oracle 10g

2004-08-05 Thread Stephan Szabo
On Thu, 5 Aug 2004, David Garamond wrote: > Stephan Szabo wrote: > >>in oracle 10g, you can issue: > >> > >> ALTER SESSION SET NLS_COMP = ansi; > >> ALTER SESSION SET NLS_SORT = binary_ci; > >> > >>do you think this is an elegant solution for case insensitive sorting & > >>searching? is there in

Re: [GENERAL] case insensitive sorting & searching in oracle 10g

2004-08-05 Thread David Garamond
Stephan Szabo wrote: in oracle 10g, you can issue: ALTER SESSION SET NLS_COMP = ansi; ALTER SESSION SET NLS_SORT = binary_ci; do you think this is an elegant solution for case insensitive sorting & searching? is there interest in seeing this in postgres? IMHO, no on both questions. There's alway

Re: [GENERAL] trash talk

2004-08-05 Thread Scott Marlowe
On Thu, 2004-08-05 at 09:01, Scott Ribe wrote: > > Interesting, IBM is saying that the code is worth 85M dollars! > > Well... Actually they're saying: "we paid $85M for it, now we're giving it > away, aren't we generous?" Hey guys, after reading the article, I began a dialog with Lisa Vaas, the a

Re: [GENERAL] most idiomatic way to "update or insert"?

2004-08-05 Thread Ron St-Pierre
Richard Huxton wrote: An "update or insert" would be useful sometimes, but it's not always necessary. Indeed, if I find I don't know whether I'm adding or updating something I take a long hard look at my design - it ususally means I've not thought clearly about something. Can you give an actual

Re: [GENERAL] Sequence Question

2004-08-05 Thread Greg Stark
Oscar Tuscon <[EMAIL PROTECTED]> writes: > I'm looking at ways to get batches of sequence values s faster. I don't want to set > cache or increment to a large number for a variety of reasons. I need to grab id's > in batches of varying numbers at various times, from 1 to several thousand at once

Re: [GENERAL] trash talk

2004-08-05 Thread Scott Ribe
> Interesting, IBM is saying that the code is worth 85M dollars! Well... Actually they're saying: "we paid $85M for it, now we're giving it away, aren't we generous?" -- Scott Ribe [EMAIL PROTECTED] http://www.killerbytes.com/ (303) 665-7007 voice ---(end of broadcast)

Re: [GENERAL] PG over NFS tips

2004-08-05 Thread Cott Lang
On Thu, 2004-08-05 at 07:37, Tom Lane wrote: > No --- the issues are not with Postgres per se but with the reliability > of your NFS setup. On top of the not-infinite reliability of disk drive > hardware you now have to stack risk of failure of the NAS machine itself, > network problems, and misc

[GENERAL] PQunescapeBytea Question

2004-08-05 Thread Jerry LeVan
Is there any chance that PQunescapeBytea will always have a \000 at the end of the unescaped buffer? unescvalue = PQgetvalue(lastResult, row, fieldNum); value = PQunescapeBytea(unescvalue, &size); ie is "value" a C string or do I have to make another copy so I can append a \000 byte? Sigh, I expec

Re: [GENERAL] Simplfied Bytea input/output?

2004-08-05 Thread David Rysdam
Incredibly, I was just sitting down to do something similar for a problem I have when I read this email. I'm going to do a temp table too, but I did think of another solution. It would work for me but it's a little complex for my stage of PG expertise: Create a user-defined type for "pic" and

[GENERAL] PG over NFS tips

2004-08-05 Thread Cott Lang
The higher-ups are attempting to force me to run Postgres over NFS at least temporarily. Despite giving me a queasy feeling and reading quite a bit of messages advising against it, running Oracle over NFS with a NAS filer doesn't seem to be unusual. Is there a reason PG would be more sensitive th

Re: [GENERAL] case insensitive sorting & searching in oracle 10g

2004-08-05 Thread Stephan Szabo
On Thu, 5 Aug 2004, David Garamond wrote: > in oracle 10g, you can issue: > > ALTER SESSION SET NLS_COMP = ansi; > ALTER SESSION SET NLS_SORT = binary_ci; > > do you think this is an elegant solution for case insensitive sorting & > searching? is there interest in seeing this in postgres? IMH

Re: [GENERAL] PG over NFS tips

2004-08-05 Thread Tom Lane
Cott Lang <[EMAIL PROTECTED]> writes: > The higher-ups are attempting to force me to run Postgres over NFS at > least temporarily. > Despite giving me a queasy feeling and reading quite a bit of messages > advising against it, running Oracle over NFS with a NAS filer doesn't > seem to be unusual.

Re: [GENERAL] Non-superuser connection limit exceeded

2004-08-05 Thread Richard Huxton
marcelo Cortez wrote: Hi folks My application fail with 'Non-superuser connection limit exceeded' error , the client application is connected via ODBC AND GPF MESSAGE appear there. the 'Non-superuser connection limit exceeded' what'wrong?. You have too many connections active, so you cannot connec

Re: [GENERAL] most idiomatic way to "update or insert"?

2004-08-05 Thread award
> An "update or insert" would be useful sometimes, but it's not always > necessary. Indeed, if I find I don't know whether I'm adding or updating > something I take a long hard look at my design - it ususally means I've > not thought clearly about something. ... > Can you give an actual example of

Re: [GENERAL] case insensitive sorting & searching in oracle 10g

2004-08-05 Thread David Garamond
- not transparent - can't automatically make all values fed to SELECT case-converted - not transparent Pierre-Frédéric Caillaud wrote: create a functional index on lower case value of your column. ORDER BY lower case value of your column. in oracle 10g, you can issue: ALTER SESSION SET N

Re: [GENERAL] psql and md5

2004-08-05 Thread Tommi Maekitalo
Hi, this would not be very useful. The database you are talking to needs to know if you know the password and not only the md5-password. If you only need to tell psql the md5-password, you don't need to know the real one. Tommi Am Montag, 2. August 2004 16:43 schrieb John DeSoi: > Is there a

Re: [GENERAL] most idiomatic way to "update or insert"?

2004-08-05 Thread Tommi Maekitalo
Hi, I prefer to update and if the number of updated rows equals 0 do an insert. So in case of update I need only one roundtrip. If insert is far more common in this case it might be better try insert and catch the error. But I try to avoid running on an error intentionally. First delete and th

Re: [GENERAL] most idiomatic way to "update or insert"?

2004-08-05 Thread Richard Huxton
Mark Harrison wrote: I've been doing something like delete from foo where name = 'xx'; insert into foo values('xx',1,2,...); but I've been wondering if there's a more idiomatic or canonical way to do this. The delete+insert isn't quite the same as an update since you might have foreign keys referr

Re: [GENERAL] case insensitive sorting & searching in oracle 10g

2004-08-05 Thread Pierre-Frédéric Caillaud
create a functional index on lower case value of your column. ORDER BY lower case value of your column. in oracle 10g, you can issue: ALTER SESSION SET NLS_COMP = ansi; ALTER SESSION SET NLS_SORT = binary_ci; do you think this is an elegant solution for case insensitive sorting &

[GENERAL] case insensitive sorting & searching in oracle 10g

2004-08-05 Thread David Garamond
in oracle 10g, you can issue: ALTER SESSION SET NLS_COMP = ansi; ALTER SESSION SET NLS_SORT = binary_ci; do you think this is an elegant solution for case insensitive sorting & searching? is there interest in seeing this in postgres? -- dave ---(end of broadcast)

Re: [GENERAL] Recursive PLPGSQL function?

2004-08-05 Thread Mark Cave-Ayland
> -Original Message- > From: DeJuan Jackson [mailto:[EMAIL PROTECTED] > Sent: 04 August 2004 17:56 > To: Mark Cave-Ayland > Cc: [EMAIL PROTECTED] > Subject: Re: [GENERAL] Recursive PLPGSQL function? > > > If I'm not mistaken you have an infinit recursion because you > are always > pul

Re: [GENERAL] Creating an hourly backup

2004-08-05 Thread Uwe C. Schroeder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Why don't you just use a simple shell script run via cron.hourly: #!/bin/sh cd /opt/backups pg_dump -R -O -a -i -Umyuser mydatabase > db_backup`date +'%Y%m%d'`.sql gzip --best *.sql I'm using the above for a daily backup in /etc/cron.daily. Look at

Re: [GENERAL] most idiomatic way to "update or insert"?

2004-08-05 Thread Pierre-Frédéric Caillaud
I use stored procedures : create function insertorupdate() UPDATE mytable WHERE ... SET ... IF NOT FOUND THEN INSERT INTO mytable ... END IF; You lose flecibility in your request though. I wish Postgresql had an INSERT OR UPDATE like MySQL does. So f