Re: [GENERAL] max execution time of query

2009-06-04 Thread Chris
S Arvind wrote: Is there any possibility to mention max time a query can execute from DBCP side? our DB is Postgres and Container is tomcat 6. we dont want to give the timeout in postgres for all query but need to set in application side based on differnet needs? Is it possible? Is there anyo

Re: [GENERAL] max execution time of query

2009-06-04 Thread A. Kretschmer
In response to S Arvind : > Is there any possibility to mention max time a query can execute from DBCP > side? our DB is Postgres and Container is tomcat 6. we dont want to give the > timeout in postgres for all query but need to set in application side based on > differnet needs? Is it possible? >

[GENERAL] max execution time of query

2009-06-04 Thread S Arvind
Is there any possibility to mention max time a query can execute from DBCP side? our DB is Postgres and Container is tomcat 6. we dont want to give the timeout in postgres for all query but need to set in application side based on differnet needs? Is it possible? Is there anyother way to specify t

Re: [GENERAL] Accessing pg_controldata information from SQL

2009-06-04 Thread Bruce Momjian
Massa, Harald Armin wrote: > Bruce, > > I am thinking your best solution is to create a table with a uuid column > > and reference that to sync up your data. That would also allow data > > dumps to be restored to another machine with the proper identifier > > because the identifier is really a ch

Re: [GENERAL] limit table to one row

2009-06-04 Thread Niklas Johansson
On 4 jun 2009, at 22.17, Richard Broersma wrote: On Thu, Jun 4, 2009 at 1:13 PM, Brandon Metcalf wrote: Is there a way when creating a table to limit it to one row? That is, without using a stored procedure? Sure just add a check constraint along the lines of: CONSTRAINT Only_one_row

Re: [GENERAL] Division by zero

2009-06-04 Thread Oliver Kohll - Mailing Lists
On 4 Jun 2009, at 13:11, Sam Mason wrote: You need to take care of only one case here: denominator == 0; rest of the cases will be handled sanely by the database. CASE WHEN packet_size = 0 THEN null ELSE cost/packet_size END as unit_cost Yes; or even shorter: cost/nullif(packet_size,

Re: [GENERAL] Using a multi-valued function in a view

2009-06-04 Thread Merlin Moncure
On Thu, Jun 4, 2009 at 4:40 PM, Radcon Entec wrote: > Merlin, > > Thank you for your reply.  Unfortunately, I was not able to get it to work. > The SQL statements you gave me generated syntax errors. > > I tried to follow your thoughts, though.  I created the following type: > > CREATE TYPE charge

Re: [GENERAL] limit table to one row

2009-06-04 Thread Brandon Metcalf
r == richard.broer...@gmail.com writes: r> On Thu, Jun 4, 2009 at 1:23 PM, Brandon Metcalf r> wrote: r> > Got it. ?Currently, it doesn't have a column for an ID, but I can add r> > one if this is the only way. r> Actually any column with a unique index on it will work. It doesn't r> hav

Re: [GENERAL] limit table to one row

2009-06-04 Thread Richard Broersma
On Thu, Jun 4, 2009 at 1:23 PM, Brandon Metcalf wrote: > Got it.  Currently, it doesn't have a column for an ID, but I can add > one if this is the only way. Actually any column with a unique index on it will work. It doesn't have to be primary key or even a serial id. ANSI-SQL 92 allows for

Re: [GENERAL] limit table to one row

2009-06-04 Thread Brandon Metcalf
r == richard.broer...@gmail.com writes: r> On Thu, Jun 4, 2009 at 1:13 PM, Brandon Metcalf r> wrote: r> > Is there a way when creating a table to limit it to one row? ?That is, r> > without using a stored procedure? r> Sure just add a check constraint along the lines of: r> CONSTRAINT On

Re: [GENERAL] limit table to one row

2009-06-04 Thread Richard Broersma
On Thu, Jun 4, 2009 at 1:13 PM, Brandon Metcalf wrote: > Is there a way when creating a table to limit it to one row?  That is, > without using a stored procedure? Sure just add a check constraint along the lines of: CONSTRAINT Only_one_row CHECK( tableuniqueid = 1 ); --assuming you row has

Re: [GENERAL] limit table to one row

2009-06-04 Thread Richard Broersma
On Thu, Jun 4, 2009 at 1:13 PM, Brandon Metcalf wrote: > Is there a way when creating a table to limit it to one row?  That is, > without using a stored procedure? Sure just add a check constraint along the lines of: CONSTRAINT Only_one_row CHECK( tableuniqueid = 1 ); --assuming you row has

[GENERAL] limit table to one row

2009-06-04 Thread Brandon Metcalf
Is there a way when creating a table to limit it to one row? That is, without using a stored procedure? I searched the documentation, but didn't find anything. -- Brandon -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.pos

Re: [GENERAL] Using a multi-valued function in a view

2009-06-04 Thread Merlin Moncure
On Thu, Jun 4, 2009 at 11:15 AM, Radcon Entec wrote: > Greetings! > > Having received the answer I needed to my question about using functions > with OUT parameters from this list (thanks very much!), I find myself > confused about how to use the function in a view.  The function chargeneeds > tak

Re: [GENERAL] is it safe to clear oroginal xlog after archiving it?

2009-06-04 Thread Simon Riggs
On Thu, 2009-06-04 at 14:42 +0200, hubert depesz lubaczewski wrote: > if zero-ing the files was safe, i could compress them more effectively. Simple rule: Never, ever, ever remove or edit any file in pg_xlog. There is a command called pg_resetxlog, though that is not designed to reduce the amou

Re: [GENERAL] recursive execute

2009-06-04 Thread Rastislav Hudak
Ok mea maxima culpa I forgot to add an important fact: the table I'm putting to get_distinct_values(..) in the recursive call is a table that has just been created in the caller function (by EXECUTE 'CREATE TABLE ' || table_name_new || '...). In the first run, the get_distinct_values(..) obtains a

Re: [GENERAL] Upgrading Database: need to dump and restore?

2009-06-04 Thread Carlos Oliva
We will probably pg_dump the data for backups and look at using Slony for replication. We thank you and Gregor for the time that you spent sharing your insights with us. "Bill Moran" wrote in message news:20090604104302.50e23318.wmo...@potentialtech.com... > In response to "Carlos Oliva" : >

[GENERAL] recursive execute

2009-06-04 Thread Rastislav Hudak
Hi, I'd like to get an array containing distinct values (always integers) form a column in a table that is provided as a parameter. So I created this function: CREATE OR REPLACE FUNCTION get_distinct_values(table_name text, param_name text) RETURNS integer[] AS $BODY$ DECLARE _values integer[];

Re: [GENERAL] Re: High I/O writes activity on disks causing images on browser to lag and not load

2009-06-04 Thread Jennifer Trey
Reporting back.. no.. I tested the track_count and autovacuum and the writes where back. / Jennifer On Thu, Jun 4, 2009 at 6:54 PM, Jennifer Trey wrote: > > > On Thu, Jun 4, 2009 at 4:58 PM, Bill Moran wrote: > >> In response to Jennifer Trey : >> > Bill, you wrote earlier : >> > >> > " >> > Addi

Re: [GENERAL] Division by zero

2009-06-04 Thread Sam Mason
On Thu, Jun 04, 2009 at 11:17:39AM -0400, Tom Lane wrote: > Sam Mason writes: > > I think that with 8.3 at least I'm going to carry on putting > > IMMUTABLE on where I think it should be. Consider: > > there are corner cases where it's useful to have the function > marked correctly rather than sl

Re: [GENERAL] Re: High I/O writes activity on disks causing images on browser to lag and not load

2009-06-04 Thread Jennifer Trey
On Thu, Jun 4, 2009 at 4:58 PM, Bill Moran wrote: > In response to Jennifer Trey : > > Bill, you wrote earlier : > > > > " > > Additionally, this convinces me further that you're chasing the wrong > > problem. The stats collector writes tiny bits of information to disk > > every time you execute

Re: [GENERAL] Move PGdata to a different drive

2009-06-04 Thread Massa, Harald Armin
Probably you do not have any script to start PostgreSQL, but it is started as a service. The data directory is a parameter of the service within services.msc, there is ... pg_ctl.exe ... -D "":\your\directory" Read up on pg_ctl --help how to change this information (pg_ctl --register) Best wish

Re: [GENERAL] Division by zero

2009-06-04 Thread Tom Lane
Sam Mason writes: > Hum, I think that with 8.3 at least I'm going to carry on putting > IMMUTABLE on where I think it should be. Consider: > CREATE FUNCTION fn_i(INTEGER) RETURNS BOOLEAN LANGUAGE SQL IMMUTABLE AS $$ > SELECT $1 < 1000 $$; > CREATE FUNCTION fn_v(INTEGER) RETURNS BOOLEAN L

[GENERAL] Using a multi-valued function in a view

2009-06-04 Thread Radcon Entec
Greetings! Having received the answer I needed to my question about using functions with OUT parameters from this list (thanks very much!), I find myself confused about how to use the function in a view.  The function chargeneeds takes one input parameter, a charge number, and has 3 output para

Re: [GENERAL] Accessing pg_controldata information from SQL

2009-06-04 Thread Massa, Harald Armin
Bruce, I am thinking your best solution is to create a table with a uuid column > and reference that to sync up your data. That would also allow data > dumps to be restored to another machine with the proper identifier > because the identifier is really a characteristic of the data, not of > the

Re: [GENERAL] Move PGdata to a different drive

2009-06-04 Thread Jennifer Trey
Ook.. thats what I wanted to know. I figured there has to be a place to change the pointer to the new location of the data. Thank you / Jennifer On Thu, Jun 4, 2009 at 6:11 PM, Bruce Momjian wrote: > Jennifer Trey wrote: > > Hi, > > What file should I be working with? > > Just shut down the serv

Re: [GENERAL] Move PGdata to a different drive

2009-06-04 Thread Bruce Momjian
Jennifer Trey wrote: > Hi, > What file should I be working with? Just shut down the server and move the directory whever you want and restart the server. There are no file contents that need changing. Of course should adjust your scripts or PGDATA environment variable. -- Bruce Momjian

Re: [GENERAL] insert from other database

2009-06-04 Thread Tom Lane
=?UTF-8?Q?Grzegorz_Ja=C5=9Bkiewicz?= writes: > On Thu, Jun 4, 2009 at 3:44 PM, Esneiker wrote: >> How can I insert data in a database from other database? >> Like this: insert into name_table select from database.table? > you can't with postgresql directly. > You can use dbconnect module from co

Re: [GENERAL] Accessing pg_controldata information from SQL

2009-06-04 Thread Bruce Momjian
Massa, Harald Armin wrote: > Bruce, > > > would be "database system identification" - the rather unique ID of a > > > > database installation. Third line in pg_controldata output: > > > > > -- > > > Datenb

Re: [GENERAL] Re: High I/O writes activity on disks causing images on browser to lag and not load

2009-06-04 Thread Bill Moran
In response to Jennifer Trey : > Bill, you wrote earlier : > > " > Additionally, this convinces me further that you're chasing the wrong > problem. The stats collector writes tiny bits of information to disk > every time you execute a command. If your system is slow because of this > tiny bit of

Re: [GENERAL] Division by zero

2009-06-04 Thread Sam Mason
On Thu, Jun 04, 2009 at 10:34:31AM -0400, Tom Lane wrote: > create function foo(int) returns int as > $$ select coalesce($1, 42); $$ language sql strict; > > Because this function is declared STRICT, it must return null on null > input. However, the contained expression would not act that way ---

[GENERAL] Move PGdata to a different drive

2009-06-04 Thread Jennifer Trey
Hi, What file should I be working with? Thanks in advance / Jennifer

Re: [GENERAL] insert from other database

2009-06-04 Thread Grzegorz Jaśkiewicz
On Thu, Jun 4, 2009 at 3:44 PM, Esneiker wrote: > Hello. > > How can I insert data in a database from other database? > > Like this: insert into name_table select from database.table? > > you can't with postgresql directly. You can use dbconnect module from contrib to do stuff like that. -- GJ

[GENERAL] insert from other database

2009-06-04 Thread Esneiker
Hello. How can I insert data in a database from other database? Like this: insert into name_table select from database.table? Thanks. Ing. Esneiker Enriquez Cabrera. Excelencia en Software. Desoft S.A. en Ciego de Ávila. Joaquín de Agüero Esq. Calle 2. Ciego de Ávila. Cuba. email:

Re: [GENERAL] Upgrading Database: need to dump and restore?

2009-06-04 Thread Bill Moran
In response to "Carlos Oliva" : > Thank you for the link to the document. It provides a wealth of > information that re-inforces your stements. It is still somewhat unclear to > me what it is that would change in the database for tables that are never > updated (not inserts, updates, or delt

Re: [GENERAL] Upgrading Database: need to dump and restore?

2009-06-04 Thread Scott Marlowe
On Thu, Jun 4, 2009 at 5:32 AM, Carlos Oliva wrote: > Thank you for your response Grzegorx.  It is helping us a great deal to > understand the issues around backups.  Would any of the pg_xlog, pg_clog, > etc change for a table that has a stable structure and data?  That is, the > table undergoes s

Re: [GENERAL] Division by zero

2009-06-04 Thread Tom Lane
Sam Mason writes: > On Thu, Jun 04, 2009 at 09:48:17AM -0400, Tom Lane wrote: >> Actually, if you're intending that a SQL function be inline-able then >> it's best *not* to mark it as IMMUTABLE (nor STRICT either). If the >> marking matches the behavior of the contained expression then it >> does

[GENERAL] no aparece opcion restaurar

2009-06-04 Thread inf200468
ßO8~Ë­­ªy×]ùë6Ó^4ëOtÓHola, me coneecto remoto a un server postgres, con el pgadmin, creo una base de datos y le doy click derecho y no me da las opciones de restaurar ni de hacer respaldo a la base de datos y cuando voy a herramientas aparecen deshabilitadas esas opciones, que puede serme cone

[GENERAL] no aparece opcion restaurar

2009-06-04 Thread inf200468
Hola, me coneecto remoto a un server postgres, con el pgadmin, creo una base de datos y le doy click derecho y no me da las opciones de restaurar ni de hacer respaldo a la base de datos y cuando voy a herramientas aparecen deshabilitadas esas opciones, que puede serme conecto con el usuari

Re: [GENERAL] warm standby with WAL shipping

2009-06-04 Thread Geoffrey
Greg Smith wrote: On Thu, 4 Jun 2009, Geoffrey wrote: For now, I'm still looking at the other tools as well as attempting to verify that my current solution doesn't miss any 'little issues.' The main thing you want to test out are that it acts sanely when the network connection to the destin

Re: [GENERAL] Upgrading Database: need to dump and restore?

2009-06-04 Thread Carlos Oliva
Thank you for the link to the document. It provides a wealth of information that re-inforces your stements. It is still somewhat unclear to me what it is that would change in the database for tables that are never updated (not inserts, updates, or deltes) after a certain point in time. That

[GENERAL] Re: High I/O writes activity on disks causing images on browser to lag and not load

2009-06-04 Thread Jennifer Trey
No, I don't have any virus programs installed. Bill, you wrote earlier : " Additionally, this convinces me further that you're chasing the wrong problem. The stats collector writes tiny bits of information to disk every time you execute a command. If your system is slow because of this tiny bit

Re: [GENERAL] Division by zero

2009-06-04 Thread Sam Mason
On Thu, Jun 04, 2009 at 09:48:17AM -0400, Tom Lane wrote: > Sam Mason writes: > > If it's an SQL function and marked as IMMUTABLE it should (I believe > > anyway) get inlined somewhere along the line and take no more overhead > > than writing it out in full. > > Actually, if you're intending that

Re: [GENERAL] Upgrading Database: need to dump and restore?

2009-06-04 Thread Bill Moran
In response to "Carlos Oliva" : > I think that I understand. Would we need to stop the databse and then do > the copy? Is this the state to which you are refering? If the tables never > changed after a week or so, what else would change in the database for these > tables after a month, two m

Re: [GENERAL] is it safe to clear oroginal xlog after archiving it?

2009-06-04 Thread Greg Smith
On Thu, 4 Jun 2009, hubert depesz lubaczewski wrote: is it safe, if i would do: dd if=/dev/zero of=$ORIGINAL_XLOG_SEGMENT bs=1M count=16 before returning from archive_command script? Nope. At that point, the files are still needed for crash recovery on that system. There will be a future po

Re: [GENERAL] warm standby with WAL shipping

2009-06-04 Thread Greg Smith
On Thu, 4 Jun 2009, Geoffrey wrote: For now, I'm still looking at the other tools as well as attempting to verify that my current solution doesn't miss any 'little issues.' The main thing you want to test out are that it acts sanely when the network connection to the destination server is out

Re: [GENERAL] Division by zero

2009-06-04 Thread Tom Lane
Sam Mason writes: > If it's an SQL function and marked as IMMUTABLE it should (I believe > anyway) get inlined somewhere along the line and take no more overhead > than writing it out in full. Actually, if you're intending that a SQL function be inline-able then it's best *not* to mark it as IMMU

Re: [GENERAL] Upgrading Database: need to dump and restore?

2009-06-04 Thread Carlos Oliva
I think that I understand. Would we need to stop the databse and then do the copy? Is this the state to which you are refering? If the tables never changed after a week or so, what else would change in the database for these tables after a month, two months, or a year? Would we need to put t

Re: [GENERAL] Upgrading Database: need to dump and restore?

2009-06-04 Thread Grzegorz Jaśkiewicz
On Thu, Jun 4, 2009 at 1:23 PM, Carlos Oliva wrote: > In which state do we need to put the db?  We can use both types of backup > strategy.  We can pg_dump the table and copy the tablespace folder along > with anyhting else that we may need. Well, not quite. Pg_dump is fine, but you can't just cop

[GENERAL] is it safe to clear oroginal xlog after archiving it?

2009-06-04 Thread hubert depesz lubaczewski
hi, i have archive_command which copies the wal segment someplace. is it safe, if i would do: dd if=/dev/zero of=$ORIGINAL_XLOG_SEGMENT bs=1M count=16 before returning from archive_command script? the point of doing so is pretty simple: i have a system with rather low traffic, so i use archive_ti

Re: [GENERAL] Upgrading Database: need to dump and restore?

2009-06-04 Thread Carlos Oliva
In which state do we need to put the db? We can use both types of backup strategy. We can pg_dump the table and copy the tablespace folder along with anyhting else that we may need. ""Grzegorz Jaskiewicz"" wrote in message news:2f4958ff0906040518l190af73dpff180755d567f...@mail.gmail.com... On

[GENERAL] Re: High I/O writes activity on disks causing images on browser to lag and not load

2009-06-04 Thread William Temperley
> Filtering out with the pid showed that it was the file > pgdata/global/pgstat.tmp >> Filtering out with the pid showed that it was the file >> pgdata/global/pgstat.tmp > > That's the statistics collector -- which makes sense, depending > on your settings, it has to write stats for every operation

Re: [GENERAL] Plpgsql functions with output parameters

2009-06-04 Thread Leif B. Kristensen
On Thursday 4. June 2009, Radcon Entec wrote: >I have been beating my head against the documentation on plpgsql > functions with output parameters for the last three hours, but I > haven't been able to get them to work yet. > > >I am playing with the sum_n_product function, taken from the > doucmen

Re: [GENERAL] warm standby with WAL shipping

2009-06-04 Thread Geoffrey
Joshua D. Drake wrote: On Wed, 2009-06-03 at 15:07 -0400, Geoffrey wrote: You are still going to need to either: A. Reinvent the wheel, by scripting it all yourself B. Use solutions that are already used by others such as walmgr or pitrtools My assumption was that since pg_standby does not hav

Re: [GENERAL] Upgrading Database: need to dump and restore?

2009-06-04 Thread Grzegorz Jaśkiewicz
On Thu, Jun 4, 2009 at 1:07 PM, Carlos Oliva wrote: > Thanks again Grzgorz for your expedicious reply.  Would anything else change > in the database for a table once it ceases to be updated?  We have several > tables for which a number of records is inserted and never again updated -- > data is ne

Re: [GENERAL] Upgrading Database: need to dump and restore?

2009-06-04 Thread Carlos Oliva
Thanks again Grzgorz for your expedicious reply. Would anything else change in the database for a table once it ceases to be updated? We have several tables for which a number of records is inserted and never again updated -- data is never updated, deleted, or inserted again. We are moving t

[GENERAL] Plpgsql functions with output parameters

2009-06-04 Thread Radcon Entec
I have been beating my head against the documentation on plpgsql functions with output parameters for the last three hours, but I haven't been able to get them to work yet. I am playing with the sum_n_product function, taken from the doucmentation: -- Function: sum_n_product(integer, integer)

Re: [GENERAL] Upgrading Database: need to dump and restore?

2009-06-04 Thread Grzegorz Jaśkiewicz
pg_xlog and clog is something that is used during operation, and for point in time recovery. It doesn't go to database dump at all, not needed. On Thu, Jun 4, 2009 at 12:32 PM, Carlos Oliva wrote: > Thank you for your response Grzegorx.  It is helping us a great deal to > understand the issues a

Re: [GENERAL] Upgrading Database: need to dump and restore?

2009-06-04 Thread Carlos Oliva
Thank you for your response Bill. It is helping us a great deal to understand the issues around backups. Would any of the pg_xlog, pg_clog, etc change for a table that has a stable structure and data? That is, the table undergoes several inserts and then it is never updated "Bill Moran" wrote i

Re: [GENERAL] Upgrading Database: need to dump and restore?

2009-06-04 Thread Carlos Oliva
Thank you for your response Grzegorx. It is helping us a great deal to understand the issues around backups. Would any of the pg_xlog, pg_clog, etc change for a table that has a stable structure and data? That is, the table undergoes several inserts and then it is never updated ""Grzegorz Jaskie

Re: [GENERAL] High I/O writes activity on disks causing images on browser to lag and not load

2009-06-04 Thread Lincoln Yeoh
At 04:44 AM 6/4/2009, Jennifer Trey wrote: No, I created a new DB, created a table, and did not even populate any data. Running select count(*) from test just now, still caused the 10-20 I/O-writes. Not sure if this is the main problem, but by default windows will write to the disk whenever f

Re: [GENERAL] High I/O writes activity on disks causing images on browser to lag and not load

2009-06-04 Thread Karsten Hilbert
On Thu, Jun 04, 2009 at 01:48:28PM +0300, Jennifer Trey wrote: > and its possible > that the two drives are misconfigured. I have checked into that a little and > can't rule it out completely. See, this is what others have talked about. You don't give details on what you checked, what you found,

Re: [GENERAL] warm standby with WAL shipping

2009-06-04 Thread Geoffrey
Greg Smith wrote: On Wed, 3 Jun 2009, Geoffrey wrote: My assumption was that since pg_standby does not have the scp/rsync functionality, I would have to either modify it, change the way we do things, or 'reinvent' a little different wheel. There are three things to setup here: 1) archive_co

Re: [GENERAL] High I/O writes activity on disks causing images on browser to lag and not load

2009-06-04 Thread Jennifer Trey
Sorry, went to bed yesterday :D I have installed postgresql-8.3.7-1-windows.exe Bill, you are right. The app does do tons of small queries, and its possible that the two drives are misconfigured. I have checked into that a little and can't rule it out completely. Yes, my images hang indefinitly,

Re: [GENERAL] Division by zero

2009-06-04 Thread Sam Mason
On Thu, Jun 04, 2009 at 12:12:09AM +0530, Gurjeet Singh wrote: > On Wed, Jun 3, 2009 at 9:18 PM, Oliver Kohll wrote: > > SELECT cost / pack_size AS unit_cost from products; > > > > Either variable could be null or zero. > > > > I don't want to write new functions, I'd rather keep it in plain SQL. >

[GENERAL] Simple, safe hot backup and recovery

2009-06-04 Thread Yoshinori Sano
Hi, all I want to achieve a simple, safe hot backup and recovery using PostgreSQL 8.3 or later. The standalone hot backup script listed in "24.3.5.1. Standalone hot backups" (http://www.postgresql.org/docs/8.3/interactive/continuous-archiving.html) seems to very helpful for me because it's simple

Re: [GENERAL] Accessing pg_controldata information from SQL

2009-06-04 Thread Massa, Harald Armin
Bruce, > would be "database system identification" - the rather unique ID of a > > database installation. Third line in pg_controldata output: > > > -- > > Datenbanksystemidentifikation:5293702