Re: [GENERAL] How do I set up automatic backups?

2008-07-30 Thread Tomasz Ostrowski
On 2008-07-29 23:47, John Cheng wrote: > Slony-I replication is also a viable choice for backups. No, it's not. Redundancy is not a substitute for backups. Slony will not help you if you do by mistake "delete from important_table" - as a copy will also have all rows deleted. For backups I'd recom

Re: [GENERAL] How do I set up automatic backups?

2008-07-30 Thread hubert depesz lubaczewski
On Tue, Jul 29, 2008 at 04:24:08PM -0400, Rob Richardson wrote: > him. The only answers I've found on the Internet involve creating a > password-less account and using that to run pg_dump. What is the > official best way to automatically back up a PostGres database? using pg_dump - yes. making i

Re: [GENERAL] How do I set up automatic backups?

2008-07-30 Thread Craig Ringer
Tomasz Ostrowski wrote: > On 2008-07-29 23:47, John Cheng wrote: >> Slony-I replication is also a viable choice for backups. > > No, it's not. Redundancy is not a substitute for backups. Slony will not > help you if you do by mistake "delete from important_table" - as a copy > will also have all r

Re: [GENERAL] Must be table owner to truncate?

2008-07-30 Thread Kevin Hunter
At 3:45p -0400 on Mon, 28 Jul 2008, Said Ramirez wrote: > According to the documentation, > http://www.postgresql.org/docs/current/interactive/sql-truncate.html , > only the owner can truncate a table. Which means the non-owner must > either log in/ switch roles as the owner, or they can just run a

Re: [GENERAL] Must be table owner to truncate?

2008-07-30 Thread Ragnar
On mið, 2008-07-30 at 07:36 -0400, Kevin Hunter wrote: > At 3:45p -0400 on Mon, 28 Jul 2008, Said Ramirez wrote: > > According to the documentation, > > http://www.postgresql.org/docs/current/interactive/sql-truncate.html , > > only the owner can truncate a table. Which means the non-owner must >

[GENERAL] Connecting to an existing transaction state.

2008-07-30 Thread Alex Gen
Hello, I’m in the process of creating a set of scripts for testing certain locking features in an application. What I would like to do: 1. Start a connection from machine-01 through the m01-s1.sql script. 2.While (1) is running, start another transaction on the same database from machine-02 usin

Re: [GENERAL] Clone a database to other machine

2008-07-30 Thread Garg, Manjit
Hi, Yes, I'm able to pg_dump the database to other server. And database is working fine there. But, actually I want to keep both the Databse in Sync. I want clone db to get the data from Master in certain intervals. DB dump size is 3 GB. Thanks and regards, -Original Message- Fr

[GENERAL] Problem running script

2008-07-30 Thread Sushma Sagaram
My requirement is 1) to write a query in a file, read the input from that file, run in postgresql and write the output(query results) into a file. I'm not able to use combination of \i and \o Let' say I have file test.sql and in test.sql I write select * from abc; Now I need to read the query from

Re: [GENERAL] Problem running script

2008-07-30 Thread Ian Lea
If you are on unix just run $ psql -whatever < test.sql > test.log Don't know about Windows. -- Ian. On Fri, Jul 25, 2008 at 6:20 PM, Sushma Sagaram <[EMAIL PROTECTED]> wrote: > My requirement is > 1) to write a query in a file, read the input from that file, run in > postgresql and write the

Re: [GENERAL] Problem running script

2008-07-30 Thread Francisco Reyes
On 9:50 am 07/30/08 "Ian Lea" <[EMAIL PROTECTED]> wrote: > $ psql -whatever < test.sql > test.log Also psql -f > test.log Almost the same as above.. > > =>\i test.sql \o test That would be wrong. Say you had test.sql select * from mytable; You can change test.sql to: \o test.log select * fro

Re: [GENERAL] Connecting to an existing transaction state.

2008-07-30 Thread Francisco Reyes
On 10:37 am 07/28/08 Alex Gen <[EMAIL PROTECTED]> wrote: > 3. Using m01-s2.sql I would like to execute a certain SQL statement > – BUT within the scope of the transaction begun by m01-s1.sql. I believe that is not possible. Specially if you are within a transaction on each of the scripts. As far

Re: [GENERAL] Must be table owner to truncate?

2008-07-30 Thread Stephen Frost
* Ragnar ([EMAIL PROTECTED]) wrote: > > On mið, 2008-07-30 at 07:36 -0400, Kevin Hunter wrote: > > At 3:45p -0400 on Mon, 28 Jul 2008, Said Ramirez wrote: > > > According to the documentation, > > > http://www.postgresql.org/docs/current/interactive/sql-truncate.html , > > > only the owner can tru

Re: [GENERAL] Connecting to an existing transaction state.

2008-07-30 Thread Alvaro Herrera
Alex Gen wrote: > Hello, > > I’m in the process of creating a set of scripts for testing certain locking > features in an application. > What I would like to do: > 1. Start a connection from machine-01 through the m01-s1.sql script. > 2.While (1) is running, start another transaction on the same

Re: [GENERAL] Clone a database to other machine

2008-07-30 Thread Raymond O'Donnell
On 28/07/2008 18:32, Garg, Manjit wrote: But, actually I want to keep both the Databse in Sync. I want clone db to get the data from Master in certain intervals. DB dump size is 3 GB. In that case, a cron job which dumps the data from the master and reloads it on the other machine may be yo

Re: [GENERAL] Clone a database to other machine

2008-07-30 Thread Raymond O'Donnell
On 30/07/2008 15:56, Garg, Manjit wrote: Actually I was looking for some method / tool (utility) which keeps both the database on different servers in sync automatically. Ah, OK - I thought you meant that you needed a clone at specific intervals. You can use Slony (www.slony.info) to do this.

Re: [GENERAL] Must be table owner to truncate?

2008-07-30 Thread Robert Treat
On Wednesday 30 July 2008 08:52:26 Ragnar wrote: > On mið, 2008-07-30 at 07:36 -0400, Kevin Hunter wrote: > > At 3:45p -0400 on Mon, 28 Jul 2008, Said Ramirez wrote: > > > According to the documentation, > > > http://www.postgresql.org/docs/current/interactive/sql-truncate.html , > > > only the own

Re: [GENERAL] Problem running script

2008-07-30 Thread Ragnar
On fös, 2008-07-25 at 10:20 -0700, Sushma Sagaram wrote: > My requirement is > 1) to write a query in a file, read the input from that file, run in > postgresql and write the output(query results) into a file. I'm not > able to use combination of \i and \o see psql --help in particular the opti

[GENERAL] Error 10061

2008-07-30 Thread Ivan Garro
Hola Gente, les comento lo que me pasa, mi base de datos (8.2) esta montada sobre un windows XP y funciona religiosamente bien, pero de repente se rompe y no funciona mas, puede estar andando dos o tres meses los mas bien. El problema lo soluciono con corriendo un pg_resetxlog.. el log es el

Re: [GENERAL] Error 10061

2008-07-30 Thread Francisco Reyes
On 1:51 pm 07/30/08 "Ivan Garro" <[EMAIL PROTECTED]> wrote: > Hola Gente, les comento lo que me pasa, Esta lista es solo para Ingles. Favor subscribirte a la lista en espan~ol en: http://archives.postgresql.org/pgsql-es-ayuda -- Sent via pgsql-general mailing list (pgsql-general@postgresql.or

Re: [GENERAL] Error 10061

2008-07-30 Thread Alvaro Herrera
Ivan Garro escribió: > Hola Gente, les comento lo que me pasa, mi base de datos (8.2) esta montada > sobre un windows XP y funciona religiosamente bien, > pero de repente se rompe y no funciona mas, puede estar andando > dos o tres meses los mas bien. El problema lo soluciono > con corriendo un pg

[GENERAL] Alternative way to access a field in a %ROWTYPE variable

2008-07-30 Thread Ismael ....
Hi, Is there another way to access to the field in a variable of type record? I need to store the name of a field in a variable and access the field whose name matches the content of the variable. Just as an example of what I want to do, the table or view "pg_user " has at least the field usenam

[GENERAL] Declaring constants in SQL

2008-07-30 Thread EXT-Rothermel, Peter M
Let's say I have a table foo with a column color where the color column is defined as an integer but in my application space is an enumeration: Table "public.foo" Column |Type | Modifiers ---+-

Re: [GENERAL] Declaring constants in SQL

2008-07-30 Thread Richard Broersma
On Wed, Jul 30, 2008 at 1:16 PM, EXT-Rothermel, Peter M <[EMAIL PROTECTED]> wrote: > Is there any means like (#define or DECLARE ) where I can write SQL like > this: > CREATE VIEW primary_colors_foos AS > SELECT * from foo WHERE ( color = FOO_COLOR_RED OR color = > FOO_COLOR_BLUE OR color = FOO_

[GENERAL] archive_timeout, checkpoint_timeout

2008-07-30 Thread Rob Adams
We want to use an archive_timeout of ~1min to minimize data loss in the event of hardware failure (archive script includes external b/u). archive_timeout only seems to work if it's >= checkpoint_timeout. Could someone please explain in layman's terms the implications of using a checkpoint_tim

Re: [GENERAL] Connecting to an existing transaction state.

2008-07-30 Thread Craig Ringer
Alvaro Herrera wrote: > Alex Gen wrote: >> Hello, >> >> I’m in the process of creating a set of scripts for testing certain locking >> features in an application. >> What I would like to do: >> 1. Start a connection from machine-01 through the m01-s1.sql script. >> 2.While (1) is running, start an

Re: [GENERAL] archive_timeout, checkpoint_timeout

2008-07-30 Thread Tom Lane
Rob Adams <[EMAIL PROTECTED]> writes: > archive_timeout only seems to work if it's >= checkpoint_timeout. Hmm, no, they should be pretty independent. Define "seems to work" please? One possible connection is that an xlog file switch will not actually happen unless some xlog output has been gener

Re: [GENERAL] archive_timeout, checkpoint_timeout

2008-07-30 Thread Rob Adams
I was referring to this post: http://archives.postgresql.org/pgsql-hackers/2007-10/msg01361.php The test database was completely idle. WAL files were only being archived at the interval specified in checkpoint_timeout (I was using the default value) -- archive_timeout didn't make them happen a

[GENERAL] Shared object "libpq.so.3" not found

2008-07-30 Thread marko
I'm running FreeBSD 6.2 and I have Postgresql 8.2.4 installed with Perl v5.8.8. I'm trying to test DBD-Pg-2.8.7 after compilation and I get this error after 'make test': PGINITDB="/usr/local/pgsql/bin/initdb" PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/li

Re: [GENERAL] Shared object "libpq.so.3" not found

2008-07-30 Thread Tom Lane
marko <[EMAIL PROTECTED]> writes: > I'm running FreeBSD 6.2 and I have Postgresql 8.2.4 installed with > Perl v5.8.8. I'm trying to test DBD-Pg-2.8.7 after compilation and I > get this error after 'make test': > # Error: Can't load '/usr/home/markuser/DBD-Pg-2.8.7/blib/arch/ > auto/DBD/Pg/Pg.

[GENERAL] boolean short-circuiting in plpgsql

2008-07-30 Thread Kev
Hi everyone, I may be missing something obvious, but it seems like the advice in 4.2.12 on http://www.postgresql.org/docs/8.3/interactive/sql-expressions.html doesn't seem to apply in plpgsql. I have a table that I want to use a trigger on when either a new row is inserted or at least one of two

Re: [GENERAL] Clone a database to other machine

2008-07-30 Thread Garg, Manjit
Hi , Actually I was looking for some method / tool (utility) which keeps both the database on different servers in sync automatically. Looking for some features into postgres.conf file if possible. Thanks and regards, Manjit Garg -Original Message- From: Raymond O'Donnell [mailto:

Re: [GENERAL] boolean short-circuiting in plpgsql

2008-07-30 Thread Tom Lane
Kev <[EMAIL PROTECTED]> writes: > ...because the case should force it to only evaluate 'old' when TG_OP > = 'UPDATE' and otherwise ('INSERT') skip through to 't'. But this > causes the same error on insert. I suspect it's because the select > query gets parameterized and at that point the 'old'

Re: [GENERAL] archive_timeout, checkpoint_timeout

2008-07-30 Thread Greg Smith
On Wed, 30 Jul 2008, Rob Adams wrote: Could someone please explain in layman's terms the implications of using a checkpoint_timeout of ~1min as well? Is it a bad idea? Lowering checkpoint_timeout makes checkpoints more frequent, causing the database to go through WAL segments (at 16MB each)