Re: [GENERAL] Baffled by failure to use index when WHERE uses a function

2006-03-10 Thread Hongxi.Ma
if ur function 'healpix' marked 'VOLATILE ' , it meas 'passed the same params may result to diffrennt result', so , database have to compare the value row by row (db does not know what u actully mean) - Original Message - From: "Clive Page" <[EMAIL PROTECTED]> To: Sent: Friday, March 10,

Re: [GENERAL] NULL TIMESTAM problem

2006-03-10 Thread Guy Rouillier
Enrique Sánchez wrote: > Hi! I'm new in Postgres. > > I nedd to fill a database table x from a file With the COPY command > an the delimiter '*'. > This table has a timestamp null column (I declared like: ' birthday > timestamp NULL' ). > > But when I try to insert NULL values(specified in the

Re: [GENERAL] in Pl/PgSQL, do commit every 5000 records

2006-03-10 Thread Florian G. Pflug
Emi Lu wrote: Florian G. Pflug wrote: < snipped code of stored procedure > Are you aware of the "insert into (, ..., ) select , .., from " command? It'd be much faster to use that it it's possible... greetings, Florian Pflug It did faster. Thank you Florian. Could you hint me why "i

Re: [GENERAL] Schema is Missing

2006-03-10 Thread Michael Fuhr
On Fri, Mar 10, 2006 at 12:57:17PM -0500, Ron St-Pierre wrote: > We received the following error on our development server this > morning (postgresql 7.4.1, debian woody): That's pretty old. If you must run 7.4 then at least consider upgrading to the latest minor release, currently 7.4.12. Lots

Re: [GENERAL] in Pl/PgSQL, do commit every 5000 records

2006-03-10 Thread Emi Lu
Florian G. Pflug wrote: < snipped code of stored procedure > Are you aware of the "insert into (, ..., ) select , .., from " command? It'd be much faster to use that it it's possible... greetings, Florian Pflug It did faster. Thank you Florian. Could you hint me why "insert into

Re: [GENERAL] Creating a function that acept any data type

2006-03-10 Thread Tom Lane
"Alejandro Michelin Salomon \( Adinet \)" <[EMAIL PROTECTED]> writes: > Can you help-me to create a function that acept any data type ? Use ANYELEMENT, not ANY. Also I'd suggest making it a SQL function not a plpgsql function, so that it can be inlined. regards, tom lane

Re: [GENERAL] Creating a function that acept any data type

2006-03-10 Thread Michael Fuhr
On Fri, Mar 10, 2006 at 05:12:53PM -0300, Alejandro Michelin Salomon ( Adinet ) wrote: > I am working in a migration. Im am migrating systems based in mysql to > postgresql. > > I am trying to create a function named IFNULL, to not migrate any ocurrence > of this mysql function in my code. > > T

[GENERAL] Creating a function that acept any data type

2006-03-10 Thread Alejandro Michelin Salomon \( Adinet \)
Hi : I am working in a migration. Im am migrating systems based in mysql to postgresql. I am trying to create a function named IFNULL, to not migrate any ocurrence of this mysql function in my code. The IFNULL function is the same of COALESCE in postgresql. This code does not work. CREATE OR R

Re: [GENERAL] Schema is Missing

2006-03-10 Thread Ron St-Pierre
> - Original Message - > From: "Michael Fuhr" <[EMAIL PROTECTED]> > To: "Ron St-Pierre" <[EMAIL PROTECTED]> > Subject: Re: [GENERAL] Schema is Missing > Date: Fri, 10 Mar 2006 11:27:54 -0700 > > > On Fri, Mar 10, 2006 at 12:57:17PM -0500, Ron St-Pierre wrote: > > We received the followin

[GENERAL] Schema is Missing

2006-03-10 Thread Ron St-Pierre
We received the following error on our development server this morning (postgresql 7.4.1, debian woody): org.postgresql.util.PSQLException: ERROR: schema "customer" does not exist When I login to postgres it looks as if the other schemas are okay, but the customer schema is gone. I have a back

Re: [GENERAL] in Pl/PgSQL, do commit every 5000 records

2006-03-10 Thread Emi Lu
Florian G. Pflug wrote: Emi Lu wrote: The example I have is: CREATE OR REPLACE function test() returns boolean AS $$ DECLARE ... ... counterINTEGER := 0; BEGIN ... ... query_value := ' .' ; OPEN curs1 FOR EXECUTE query_value; LOOP FETCH curs1 INTO studid;

Re: [GENERAL] in Pl/PgSQL, do commit every 5000 records

2006-03-10 Thread Florian G. Pflug
Emi Lu wrote: The example I have is: CREATE OR REPLACE function test() returns boolean AS $$ DECLARE ... ... counterINTEGER := 0; BEGIN ... ... query_value := ' .' ; OPEN curs1 FOR EXECUTE query_value; LOOP FETCH curs1 INTO studid; EXIT WHEN NOT FOUND;

Re: [GENERAL] in Pl/PgSQL, do commit every 5000 records

2006-03-10 Thread Emi Lu
I got the answer. Although the compile passed, when it reaches 5000, the commit command causes a "SPI_ERROR_TRANSACTION" exception. Thank you for all your hint. You can't do commits inside of a function. The example I have is: CREATE OR REPLACE function test() returns boolean AS $$ DECLAR

Re: [GENERAL] programatic database dump

2006-03-10 Thread Reid Thompson
Tomi NA wrote: I'd like to dump a postgresql database from my (java) app and copy the dump file to the client machine. This backup strategy prooved invalueable in the past (given enough room on the harddrives, which I have) and I'd like to implement it now with postgresql. Is there something li

[GENERAL] programatic database dump

2006-03-10 Thread Tomi NA
I'd like to dump a postgresql database from my (java) app and copy the dump file to the client machine.This backup strategy prooved invalueable in the past (given enough room on the harddrives, which I have) and I'd like to implement it now with postgresql. Is there something like a system stored p

Re: [GENERAL] About updates

2006-03-10 Thread Emi Lu
Thanks Andreas. That was a quick response. So way 1 must be quicker. am 10.03.2006, um 10:46:39 -0500 mailte Emi Lu folgendes: Hello, postgresql 8.0.1, in a plpgsql function To update columns' values in a table (without OID), if I ran: 1. "update table1 set col1 = ..., col2 = ... ... c

Re: [GENERAL] About updates

2006-03-10 Thread A. Kretschmer
am 10.03.2006, um 10:46:39 -0500 mailte Emi Lu folgendes: > Hello, > > postgresql 8.0.1, in a plpgsql function > > To update columns' values in a table (without OID), if I ran: > 1. "update table1 set col1 = ..., col2 = ... ... col100 =" > > or > 2. > "update table1 set col1 = " > ... > "update

Re: [GENERAL] in Pl/PgSQL, do commit every 5000 records

2006-03-10 Thread Emi Lu
Hi Bruno, You can't do commits inside of a function. The example I have is: CREATE OR REPLACE function test() returns boolean AS $$ DECLARE ... ... counterINTEGER := 0; BEGIN ... ... query_value := ' .' ; OPEN curs1 FOR EXECUTE query_value; LOOP FETCH curs1 I

Re: [GENERAL] in Pl/PgSQL, do commit every 5000 records

2006-03-10 Thread Bruno Wolff III
On Fri, Mar 10, 2006 at 09:36:16 -0500, Emi Lu <[EMAIL PROTECTED]> wrote: > Good morning, > > In a plpgsql function, I am trying to insert 900, 000 records into > several tables. I remembered people mentioned before that it is better > and more efficient to commit actions for let's say every 5

[GENERAL] About updates

2006-03-10 Thread Emi Lu
Hello, postgresql 8.0.1, in a plpgsql function To update columns' values in a table (without OID), if I ran: 1. "update table1 set col1 = ..., col2 = ... ... col100 =" or 2. "update table1 set col1 = " ... "update table1 set col100 = " way 1 only has one disk I/O, right? While way 2 is more ti

Re: [GENERAL] panic during pgsql startup

2006-03-10 Thread Tom Lane
[EMAIL PROTECTED] writes: > I can't start postgresql. I'm getting: > PANIC: failed to re-find parent key in "17497" > in serverlog. Is this happening during WAL replay? If so, you could probably get the database to start by doing pg_resetxlog. No guarantees about how consistent your data will b

[GENERAL] panic during pgsql startup

2006-03-10 Thread igor
Message-ID: 11616 Hi All, I can't start postgresql. I'm getting: PANIC: failed to re-find parent key in "17497" in serverlog. It's PostgreSQL v8.1.3 on Fedora Core 4, ~15g database. Is there any way do dump my data and/or fix it ? I do have a backup, and this is probably a problem w/ my hdd

[GENERAL] in Pl/PgSQL, do commit every 5000 records

2006-03-10 Thread Emi Lu
Good morning, In a plpgsql function, I am trying to insert 900, 000 records into several tables. I remembered people mentioned before that it is better and more efficient to commit actions for let's say every 5000 records' insertion. May I get more inputs about why and how this commit can sp

Re: [GENERAL] Baffled by failure to use index when WHERE uses a

2006-03-10 Thread Clive Page
On Fri, 10 Mar 2006, Martijn van Oosterhout wrote: You don't describe the exact structure of your table nor the exact declaraion of your function, but is it possible your function is marked VOLATILE rather tha STABLE or IMMUTABLE? Thanks for that hint - my function was not marked in any way, s

Re: [GENERAL] PL/pgSQL question

2006-03-10 Thread Richard Huxton
[EMAIL PROTECTED] wrote: Hi All! First of all, a great Thanks, your suggestions works fine. I'll hope to enhance a little bit my understanding of SETOF return type. I have now two problems. 1) I would like to return some columns from one table in PL/pgSQL function. What's in this case the corr

Re: [GENERAL] Baffled by failure to use index when WHERE uses a function

2006-03-10 Thread Richard Huxton
Clive Page wrote: I have a table cov3 of about 3 million rows, with a B-tree index on an integer column called hpix. If I do a simple select on this column it works in milliseconds, using the index naturally: select * from cov3 where hpixint = 482787587; hpix| expos | hpixint --

Re: [GENERAL] Storage Estimates

2006-03-10 Thread Richard Huxton
Nik wrote: Is there any documentation or literature on storage estimation for PostgreSQL 8.1 on Windows? At times like this I always start with the manuals, then follow with mailing-list searches. The section on "Database Physical Storage" is probably a good place to start. http://www.po

Re: [GENERAL] Baffled by failure to use index when WHERE uses a function

2006-03-10 Thread Michael Fuhr
On Fri, Mar 10, 2006 at 09:14:27AM +, Clive Page wrote: > I have a table cov3 of about 3 million rows, with a B-tree index on an > integer column called hpix. If I do a simple select on this column it > works in milliseconds, using the index naturally: > > select * from cov3 where hpixint =

Re: [GENERAL] Baffled by failure to use index when WHERE uses a function

2006-03-10 Thread Martijn van Oosterhout
On Fri, Mar 10, 2006 at 09:14:27AM +, Clive Page wrote: > I have a table cov3 of about 3 million rows, with a B-tree index on an > integer column called hpix. If I do a simple select on this column it > works in milliseconds, using the index naturally: > So I would like to use this functi

[GENERAL] Baffled by failure to use index when WHERE uses a function

2006-03-10 Thread Clive Page
I have a table cov3 of about 3 million rows, with a B-tree index on an integer column called hpix. If I do a simple select on this column it works in milliseconds, using the index naturally: select * from cov3 where hpixint = 482787587; hpix| expos | hpixint ---+-+---

Re: [GENERAL] PL/pgSQL question

2006-03-10 Thread ycrux
Hi All! First of all, a great Thanks, your suggestions works fine. I'll hope to enhance a little bit my understanding of SETOF return type. I have now two problems. 1) I would like to return some columns from one table in PL/pgSQL function. What's in this case the correct return type of the PL/p

Re: [GENERAL] Out of memory error on pg_restore

2006-03-10 Thread Guillaume Lelarge
8 Mar 2006 07:31:19 -0800, Nik <[EMAIL PROTECTED]>: > [...] > psql: ERROR: out of memory > DETAIL: Failed on request of size 32. > I also have this kind of error (out of memory) during the restoration of objects on my database. I use a 8.1.2 pg_dump on a 7.1.1 PostgreSQL server. Size of the dump i