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 recommend for example pg_dump and duplicity run from cron.

Regards
Tometzky
-- 
...although Eating Honey was a very good thing to do, there was a
moment just before you began to eat it which was better than when you
were...
  Winnie the Pooh

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


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 it's account passwordless - not necessarily.
you can use various methods of getting access to database without
password. you can use ident sameuser authentication method in
pg_hba.conf. you can use pgpass file, use can use PGPASSWORD environment
variable. there are also another ways, but these look the best for me.

depesz

-- 
Linked in: http://www.linkedin.com/in/depesz
jid/gtalk: [EMAIL PROTECTED]
aim:   depeszhdl
skype: depesz_hdl

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


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 rows deleted.
 
 For backups I'd recommend for example pg_dump and duplicity run from cron.

Yep ... there's nothing like having a plain-text, or at least stable
format (-Fc) copy of your data around for disaster recovery. It's not
particularly time and space efficient, but it's certainly reassuring.

For anything important, especially where you cannot afford to lose a
whole day's work, I'd also want to consider using log shipping based
PITR. That way, you lose at most (depending on configuration) say 15
minutes.

Real-time replication to a remote site with slony or similar can help
protect you against fire, theft, etc though.

--
Craig Ringer

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


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 DELETE.

Well that's interesting.  From a security standpoint, what's the
difference between an unqualified DELETE and a TRUNCATE?

Also interesting to note that TRUNCATE is transaction safe, but not MVCC
safe.  Good to know, good to know ...

Kevin

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


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
  either log in/ switch roles as the owner, or they can just run a DELETE.
 
 Well that's interesting.  From a security standpoint, what's the
 difference between an unqualified DELETE and a TRUNCATE?

lack of triggers and RULEs spring to mind.

gnari



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[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 using m02-s1.sql.

At this point in time, there are two open transactions on certain tables in the 
same database.

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.
4. Current situation: Since there are several .sql scripts, each getting its 
own connection and executing sql stmts – they are not aware of activities of 
the other scripts (i.e. the open transactions).
5. What I’d like to do: After a transaction has been started from a machine, I 
should be able to save the transaction reference (id?) temporarily somewhere.
6. The next statement (new .sql file) that wishes to execute within the scope 
of the above transaction – should be able to get the transaction reference (id) 
and latch onto it in its current state. This way it continues to perform as 
part of a whole – rather than only executing the statements that it had.

Any guidance in this will help.

Cheers!
AlexiG




  __
Not happy with your email address?.
Get the one you really want - millions of new email addresses available now at 
Yahoo! http://uk.docs.yahoo.com/ymail/new.html

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


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-
From: Francisco Reyes [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 28, 2008 10:42 PM
To: Garg, Manjit
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Clone a database to other machine

On 12:44 pm 07/28/08 Garg, Manjit [EMAIL PROTECTED] wrote:
 I'm stuck to an  issue while cloning the pgsql database, can you 
 please help, or give any docs to  help out.

What is the issue?

 Query - Trying to  have same database on two seprate linux servers.

Have you been able to pg_dump from the source DB and then read it in the
target?

Are you trying to do replication or you just want point in times?
How large is the database?


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[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 the file and write the output to a file.
I tried
=\i test.sql \o test
but that is not working. I want to write a script which reads query from
file and write output in a file and I want to do everything in one script
and run it background at a particular time of teh day.
2) How do I run scripts in postgresql? How do I set the shell and execute
the script?

Regards,
Sushma


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 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 the file and write the output to a file.
 I tried
 =\i test.sql \o test
 but that is not working. I want to write a script which reads query from
 file and write output in a file and I want to do everything in one script
 and run it background at a particular time of teh day.
 2) How do I run scripts in postgresql? How do I set the shell and execute
 the script?

 Regards,
 Sushma



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


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 filename  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 * from mytable;

Then you could do \i test.sql and accomplish what you are trying to do.

If your DB has passwords enable you may need to put the user/password combo
in .pgpass.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


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 as I know all the work getting done inside a transaction is ONLY
visible to that transaction. It would actually be pretty bad if the
database allowed a process to see an uncommited state from a transaction
that may end up rolling back.

What are you trying to test?
You mentioned how you are testing, but what is the business need? Or
business concern?

ie It could be something like.. we are concerned that if we run these two
scripts one may lock the other.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


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 truncate a table. Which means the non-owner must
   either log in/ switch roles as the owner, or they can just run a DELETE.
  
  Well that's interesting.  From a security standpoint, what's the
  difference between an unqualified DELETE and a TRUNCATE?
 
 lack of triggers and RULEs spring to mind.

It also takes a bigger lock on the table than DELETE, which may or may
not be considered a security issue.  triggers really are the big issue
wrt security and why it deserves to be a seperatelly grantable
permission from delete.

Thanks,

Stephen


signature.asc
Description: Digital signature


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 database from 
 machine-02 using m02-s1.sql.
 
 At this point in time, there are two open transactions on certain tables in 
 the same database.
 
 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.
 4. Current situation: Since there are several .sql scripts, each getting its 
 own connection and executing sql stmts – they are not aware of activities of 
 the other scripts (i.e. the open transactions).
 5. What I’d like to do: After a transaction has been started from a machine, 
 I should be able to save the transaction reference (id?) temporarily 
 somewhere.
 6. The next statement (new .sql file) that wishes to execute within the scope 
 of the above transaction – should be able to get the transaction reference 
 (id) and latch onto it in its current state. This way it continues to perform 
 as part of a whole – rather than only executing the statements that it had.

You cannot do this directly by simply using SQL files being fed to psql.
What you can do is open one psql process reading from a named pipe, and
write SQL commands to this pipe.

I was able to do this with some shell tricks; it read a single SQL file
which had commands prefixed by a session number, and executed each
command in a different session by echoing them to the pipe attached to
each session.  (You must have a separate process keeping the pipe open
for writing in between; otherwise psql gets a SIGPIPE and dies after the
first echo finishes).

I don't have the script around anymore though :-(

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


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 your best bet.


Ray.

--
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
[EMAIL PROTECTED]
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
--

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


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. A couple of 
caveats, however:


(i) If you use the 1.* version (the only currently stable version), you 
can't use pg_dump to dump from the slaves - this is because Slony 1.* 
rewrites the system catalogues in strange ways. :-)


(ii) Slony 2.0 (currently at RC1) does allow you to get a consistent 
dump from the slaves, but you need to be running PostgreSQL 8.3 or later.


Ray.

--
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
[EMAIL PROTECTED]
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
--

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


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 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
   DELETE.
 
  Well that's interesting.  From a security standpoint, what's the
  difference between an unqualified DELETE and a TRUNCATE?

 lack of triggers and RULEs spring to mind.


Just fyi, there is a patch for 8.4 that will add truncate permissions. 

-- 
Robert Treat
Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


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 options -f , -c and -o

gnari



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[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 siguiente:

LOG:  database system was shut down at 2008-07-30 10:21:08 Hora est. de 
Sudamérica E.
LOG:  checkpoint record is at 0/11C0
LOG:  redo record is at 0/11C0; undo record is at 0/0; shutdown TRUE
LOG:  next transaction ID: 0/725046; next OID: 17508
LOG:  next MultiXactId: 1; next MultiXactOffset: 0
LOG:  database system is ready
LOG:  could not receive data from client: Unknown winsock error 10061
LOG:  unexpected EOF on client connection

soy nuevo en esto y les agradezco su ayuda

Ivan


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.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


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_resetxlog.. 
 
 el log es el siguiente:
 
 LOG:  database system was shut down at 2008-07-30 10:21:08 Hora est. de 
 Sudamérica E.
 LOG:  checkpoint record is at 0/11C0
 LOG:  redo record is at 0/11C0; undo record is at 0/0; shutdown TRUE
 LOG:  next transaction ID: 0/725046; next OID: 17508
 LOG:  next MultiXactId: 1; next MultiXactOffset: 0
 LOG:  database system is ready
 LOG:  could not receive data from client: Unknown winsock error 10061
 LOG:  unexpected EOF on client connection

Huh, this is really weird.  10061 is CONNREFUSED according to
http://msdn.microsoft.com/en-us/library/ms740668.aspx

Exactly what 8.2.x version are you running?

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[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 usename, usesysid, valuntil

So I need to access the fields in a way similar to this
DECLARE
row pg_user%ROWTYPE;
field VARCHAR';

BEGIN
field = 'usename';
row.field = 'name';
field = 'usesysid';
row.field = 0;
field = 'valuntil':
row.field = 'who knows';


Is it possible to do something like that?
because that example doesn't work

I'm using plpgsql;

tanks in advance
_
PlugPlay te trae en exclusiva los mejores conciertos de la red
http://club.prodigymsn.com/ 
-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[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

---+-+--
--
 fid   | character varying(10)   | not null
 color | integer | not null

The enumerated values are enum color_type { RED=1, BLUE=2, YELLOW=3,
GREEN=4, PURPLE=5 }

When I write a function in plpgsql I can declare constants as follows:

CREATE OR REPLACE FUNCTION bar() RETURNS TRIGGER AS
$$
DECLARE
FOO_COLOR_RED   CONSTANTINT :=  1;
FOO_COLOR_BLUE  CONSTANTINT :=  2;
FOO_COLOR_YELLOWCONSTANTINT :=  3;
BEGIN

-- FOO_COLOR_RED is more legible than 1 --
IF new.color = FOO_COLOR_RED THEN
-- some red logic here --
END IF;

RETURN new;
END;
$$ LANGUAGE plpgsql;

Let's say I want a VIEW of all the foo records that have primary colors:

CREATE VIEW primary_color_foos AS
   SELECT * FROM foo WHERE ( color = 1 OR color = 2 OR color = 3 );

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_COLOR_YELLOW );

I would like to make my RULEs and VIEWs a little more human readable.

I am using postgreSQL 8.2 that does not directly support the enum data
type.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


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_COLOR_YELLOW );

I don't think that you can declare SQL variables like this.  The
conventional method would be to use a look up table that hold the
cross-reference between integer and color name.  You could then change
your view definitional like so:

CREATE VIEW primary_colors_foos AS
  SELECT * FROM foo
   WHERE color = ANY( SELECT colorid
FROM Colors
   WHERE colorname = ANY( 'red', 'blue', 'yellow' ));

-- 
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[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_timeout of ~1min as well?  Is it a bad idea?


We use PostgreSQL 8.3 on Windows.

Thanks,
Rob Adams

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


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 another transaction on the same database from 
 machine-02 using m02-s1.sql.

 At this point in time, there are two open transactions on certain tables in 
 the same database.

 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.
 4. Current situation: Since there are several .sql scripts, each getting its 
 own connection and executing sql stmts – they are not aware of activities of 
 the other scripts (i.e. the open transactions).
 5. What I’d like to do: After a transaction has been started from a machine, 
 I should be able to save the transaction reference (id?) temporarily 
 somewhere.
 6. The next statement (new .sql file) that wishes to execute within the 
 scope of the above transaction – should be able to get the transaction 
 reference (id) and latch onto it in its current state. This way it continues 
 to perform as part of a whole – rather than only executing the statements 
 that it had.
 
 You cannot do this directly by simply using SQL files being fed to psql.
 What you can do is open one psql process reading from a named pipe, and
 write SQL commands to this pipe.

Yep. You can also write a file that sources the others, and use psql to
load that. Eg:

BEGIN;
\i m01-s1.sql
\i m01-s2.sql
COMMIT;

Another option is to write a wrapper program using one of the scripting
languages with PostgreSQL interfaces (Python, Perl, etc) that
establishes a connection then loads a sequence of snippets and sends
them. That's a little more flexible, but not much more complicated.

--
Craig Ringer

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


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 generated since the last switch.
If you were watching an otherwise-idle system then maybe the checkpoint
records are needed to make it look like a switch is needed.  OTOH if
it's *that* idle then the checkpoints should be no-ops too.  So we
need a bit more context to understand what's happening.  How often
do real updates happen on your database?

regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


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 any faster.


Upon retesting, archive_timeout is working properly when there are 
regular updates happening to the database.


Thanks for your help!
--Rob Adams


Tom Lane wrote:

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 generated since the last switch.
If you were watching an otherwise-idle system then maybe the checkpoint
records are needed to make it look like a switch is needed.  OTOH if
it's *that* idle then the checkpoints should be no-ops too.  So we
need a bit more context to understand what's happening.  How often
do real updates happen on your database?

regards, tom lane



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[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/lib', 'blib/
arch') t/*.t
t/00-signature..skipped
all skipped: Set the environment variable TEST_SIGNATURE to
enable this test
t/00basic...ok
1/3
#   Failed test 'use DBD::Pg;'
t/00basic...NOK 2#   in t/00basic.t at line
14.
# Tried to use 'DBD::Pg'.
# Error:  Can't load '/usr/home/markuser/DBD-Pg-2.8.7/blib/arch/
auto/DBD/Pg/Pg.so' for module DBD::Pg: Shared object libpq.so.3 not
found, required by Pg.so at /usr/local/lib/perl5/5.8.8/mach/
DynaLoader.pm line 230.
#  at (eval 8) line 2
# Compilation failed in require at (eval 8) line 2.
# BEGIN failed--compilation aborted at t/00basic.t line 14.
FAILED--Further testing stopped: Cannot continue without DBD::Pg
*** Error code 2

Stop in /usr/home/markuser/DBD-Pg-2.8.7.
-
At first I was getting 'Undefined symbol PQserverVersion' error
during 'make test' and it complained about not being able to find
libpq.so.5 I believe.  I fixed that by putting '/usr/local/pgsql/lib'
in ld.so.conf and running ldconfig so that it could find that file.
Then I also included '/usr/local/lib' in that file, which is the path
to libpq.so.3, but its acting like it still can't find it, as you see
above.  It seems that I can't prioritize between searching between
these two directories.  It varies between errors for not finding
libpq.so.5 or libpq.so.3.  I can't seem to provide both library files
at the same time.  Using the LD_LIBRARY_PATH environmental variable
doesn't seem to help this issue either.  I've included both library
directories (separately by a colon, if that's correct) and its no
help.

Now, of course, I've googled this and nothing is helping at this
point.  Does anyone have any other pointers?  Is this a FreeBSD thing
possibly?  I'd *much* appreciate some help here!



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


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.so' for module DBD::Pg: Shared object libpq.so.3 not
 found, required by Pg.so at /usr/local/lib/perl5/5.8.8/mach/
 DynaLoader.pm line 230.

libpq.so.3 corresponds to the libpq version that was shipped in
PG release series 7.3.x and 7.4.x.  8.2 provides libpq.so.5.

Your subsequent comments make it pretty clear that you've got
(at least portions of) both 7.x and 8.x PG installations on your
machine.  I'd suggest flushing all traces of the older one and
then rebuilding DBD::Pg from a clean start.  Somehow it's been
seizing on the older PG installation as the one to link to...

regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general