Re: [GENERAL] problems after restoring from a pg_basebackup

2012-04-27 Thread Guillaume Lelarge
On Fri, 2012-04-27 at 16:25 -0700, Lonni J Friedman wrote: > Greetings, > I'm running postgresql-9.1.3 on a Linux-x86_64 (Fedora16, if it > matters) system. I noticed the existence of pg_basebackup starting in > 9.1, and figured I'd try it out and see if it would simplify our > backup & management

Re: [GENERAL] postgresql standby using pg_archivecleanup don't work

2012-04-27 Thread raghu ram
On Fri, Apr 27, 2012 at 11:44 AM, leo xu wrote: > i have one parimary ,two standby. one standby using stream replication > connect to primary.another standby using basebackup,then recovery database > --cp archivelog from primary using crontab.i want to delete old archivelog > from standby.but con

[GENERAL] problems after restoring from a pg_basebackup

2012-04-27 Thread Lonni J Friedman
Greetings, I'm running postgresql-9.1.3 on a Linux-x86_64 (Fedora16, if it matters) system. I noticed the existence of pg_basebackup starting in 9.1, and figured I'd try it out and see if it would simplify our backup & management processes. $ pg_basebackup -P -v -D /tmp/backup -x -Ft -z -U postgr

Re: [GENERAL] How to get the all the activities running during specific time range.Thanks!Plese help!

2012-04-27 Thread Josh Kupershmidt
On Fri, Apr 27, 2012 at 7:32 AM, leaf_yxj wrote: > I was asked to run a report to my boss all the activities running during a > specific time range. I want to create a script to run it. I know I can query > from  pg_stat_activity for my previous postgres version. But I can't find > this system tab

Re: [GENERAL] How to add "on delete cascade" constraints

2012-04-27 Thread Alexander Farber
Thank you - this has worked perfectly On Fri, Apr 27, 2012 at 10:18 PM, Richard Broersma wrote: > You could, but you don't need to since you can do all of this is one > statement: > > ALTER TABLE public.pref_scores > DROP CONSTRAINT pref_scores_gid_fkey, > ADD CONSTRAINT pref_scores_gid_fkey >  

Re: [GENERAL] How to add "on delete cascade" constraints

2012-04-27 Thread Richard Broersma
On Fri, Apr 27, 2012 at 12:40 PM, Alexander Farber wrote: > So it's not a problem to drop and recreate the FOREIGN KEYs? > > And can I use START TRANSACTION while doing it? You could, but you don't need to since you can do all of this is one statement: ALTER TABLE public.pref_scores DROP CONSTRA

Re: [GENERAL] How to add "on delete cascade" constraints

2012-04-27 Thread Raymond O'Donnell
On 27/04/2012 20:40, Alexander Farber wrote: > So it's not a problem to drop and recreate the FOREIGN KEYs? No, unless you're doing it on a production system, and someone inserts a value that'll doesn't agree with the foreign key while it's gone. Adding the constraint back in may take a while (de

Re: [GENERAL] how to execute a stored function that returns a boolean?

2012-04-27 Thread Merlin Moncure
On Fri, Apr 27, 2012 at 2:43 PM, J.V. wrote: > I have created a stored function and wish to execute in pgadmin but keep > getting an error. > > create or replace function myfunc() returns boolean > as $$ > declare > begin > ... > end; > $$ language plpgsql; > > compiles and works just find, howeve

Re: [GENERAL] how to execute a stored function that returns a boolean?

2012-04-27 Thread Raymond O'Donnell
On 27/04/2012 20:43, J.V. wrote: > I have created a stored function and wish to execute in pgadmin but keep > getting an error. > > create or replace function myfunc() returns boolean > as $$ > declare > begin > ... > end; > $$ language plpgsql; > > compiles and works just find, however when I ru

[GENERAL] how to execute a stored function that returns a boolean?

2012-04-27 Thread J.V.
I have created a stored function and wish to execute in pgadmin but keep getting an error. create or replace function myfunc() returns boolean as $$ declare begin ... end; $$ language plpgsql; compiles and works just find, however when I run (in pgadmin III) select myfunc(); I get errors tell

Re: [GENERAL] How to add "on delete cascade" constraints

2012-04-27 Thread Alexander Farber
So it's not a problem to drop and recreate the FOREIGN KEYs? And can I use START TRANSACTION while doing it? On Fri, Apr 27, 2012 at 9:30 PM, Raymond O'Donnell wrote: > On 27/04/2012 19:59, Alexander Farber wrote: >> in 8.4.9 is it please possible to add "on delete cascades" to >> the both forei

Re: [GENERAL] How to add "on delete cascade" constraints

2012-04-27 Thread Raymond O'Donnell
On 27/04/2012 19:59, Alexander Farber wrote: > Hello, > > in 8.4.9 is it please possible to add "on delete cascades" to > the both foreign keys in the following table w/o dropping the table? I think you will have to drop the foreign key and re-create it, but certainly not the table. Ray. -- Ra

[GENERAL] How to add "on delete cascade" constraints

2012-04-27 Thread Alexander Farber
Hello, in 8.4.9 is it please possible to add "on delete cascades" to the both foreign keys in the following table w/o dropping the table? # \d pref_scores Table "public.pref_scores" Column | Type | Modifiers -+---+--- id | char

Re: [GENERAL] Re: how to set up automatically startup database when the server boot or reboot.

2012-04-27 Thread Welty, Richard
in the RHEL and related linux systems (Fedora, CentOS, Amazon EC2 Linux), use this command: chkconfig postgresql on to set up postgresql to start at boot. it needs to be executed as root. richard -Original Message- From: pgsql-general-ow...@postgresql.org on behalf of leaf_yxj Sent

Re: [GENERAL] Re: how to set up automatically startup database when the server boot or reboot.

2012-04-27 Thread John R Pierce
On 04/27/12 10:22 AM, leaf_yxj wrote: My os is redhat linux 5.5. And My database is greenplum 4.2.1( postgresql 8.2.15). I will take a look about the init.d directory. greenplum is a highly modified and custom version of postgres, you should consult with them as to how they have it setup.

Re: [GENERAL] empty role names in pg_dumpall output

2012-04-27 Thread Filip Rembiałkowski
On Fri, Apr 27, 2012 at 10:23 AM, Tom Lane wrote: > Ah-ha.  How about the member and grantor OIDs in those rows --- do > they correspond to still-existing roles?  (I believe "10" would be > the bootstrap superuser, so that should certainly still exist, but > those other numbers are for user-made

Re: [GENERAL] Re: how to set up automatically startup database when the server boot or reboot.

2012-04-27 Thread Michael Nolan
Your options range from doing something simple to something complex. A simple option on a Linux server would be placing a command like this in /etc/rc/rc.local: su - postgres -C "/usr/local/pgsql/bin/pg_ctl -D ;/usr/local/pgsql/data -l /usr/local/pgsql/logfile start" However, that might not be t

Re: [GENERAL] Re: how to set up automatically startup database when the server boot or reboot.

2012-04-27 Thread h...@101-factory.eu
are there any usefull startup script when eiunning in master slave setup with pg pool? Henk On 27 apr. 2012, at 19:22, leaf_yxj wrote: > My os is redhat linux 5.5. And My database is greenplum 4.2.1( postgresql > 8.2.15). I will take a look about the init.d directory. > > Thanks. Guys. Any

Re: [GENERAL] empty role names in pg_dumpall output

2012-04-27 Thread Tom Lane
=?UTF-8?Q?Filip_Rembia=C5=82kowski?= writes: > On Wed, Apr 25, 2012 at 8:56 PM, Tom Lane wrote: >> Hmm. A look at the code in pg_dumpall suggests that the problem is >> unmatched entries in pg_auth_members, ie this query: >> >> SELECT ur.rolname AS roleid >> FROM pg_auth_members a LEFT JOIN pg_

[GENERAL] Re: how to set up automatically startup database when the server boot or reboot.

2012-04-27 Thread leaf_yxj
My os is redhat linux 5.5. And My database is greenplum 4.2.1( postgresql 8.2.15). I will take a look about the init.d directory. Thanks. Guys. Any opinion is welcome. Please help. -- View this message in context: http://postgresql.1045698.n5.nabble.com/how-to-set-up-automatically-startup-data

Re: [GENERAL] how to create a sequence in a stored proc?

2012-04-27 Thread Steve Atkins
On Apr 27, 2012, at 9:35 AM, J.V. wrote: > Right, I understand that fully, and have used SQL inside a stored proc > before, but in this case as I mentioned, I need to first do a select from a > table to get a max value, store that in a variable and then use that variable > in a create sequence

Re: [GENERAL] how to create a sequence in a stored proc?

2012-04-27 Thread Raymond O'Donnell
On 27/04/2012 17:35, J.V. wrote: > Right, I understand that fully, and have used SQL inside a stored proc > before, but in this case as I mentioned, I need to first do a select > from a table to get a max value, store that in a variable and then use > that variable in a create sequence sql statemen

Re: [GENERAL] how to create a sequence in a stored proc?

2012-04-27 Thread Merlin Moncure
On Fri, Apr 27, 2012 at 11:35 AM, J.V. wrote: > Right, I understand that fully, and have used SQL inside a stored proc > before, but in this case as I mentioned, I need to first do a select from a > table to get a max value, store that in a variable and then use that > variable in a create sequenc

Re: [GENERAL] empty role names in pg_dumpall output

2012-04-27 Thread Filip Rembiałkowski
On Wed, Apr 25, 2012 at 8:56 PM, Tom Lane wrote: > =?UTF-8?Q?Filip_Rembia=C5=82kowski?= writes: >> PostgreSQL 9.0.4 > >> I have this in pg_dumpall -g output (non-empty role names changed): > >> GRANT "" TO a  GRANTED BY postgres; >> GRANT "" TO b GRANTED BY c; >> GRANT "" TO b GRANTED BY c; >> GR

Re: [GENERAL] how to create a sequence in a stored proc?

2012-04-27 Thread J.V.
Right, I understand that fully, and have used SQL inside a stored proc before, but in this case as I mentioned, I need to first do a select from a table to get a max value, store that in a variable and then use that variable in a create sequence sql statement. so I need to construct a string t

Re: [GENERAL] how to create a sequence in a stored proc?

2012-04-27 Thread Merlin Moncure
On Fri, Apr 27, 2012 at 10:37 AM, J.V. wrote: > I need to create a sequence in a stored procedure. > > First I need to select a value from a table and set the sequence start value > to that value. > > We have a table that does not have a sequence on it, so I want to select the > max value, increme

[GENERAL] how to create a sequence in a stored proc?

2012-04-27 Thread J.V.
I need to create a sequence in a stored procedure. First I need to select a value from a table and set the sequence start value to that value. We have a table that does not have a sequence on it, so I want to select the max value, increment by one and then start the sequence there. We have

Re: [GENERAL] how to set up automatically startup database when the server boot or reboot.

2012-04-27 Thread David Johnston
FYI: While is won’t impact this particular response the 8.2 release is no longer supported. Also, Linux has various flavors and while they are similar in many ways the distribution that you are using is good information to provide. I will assume you installed PostgreSQL via a package mana

Re: [GENERAL] Re: how to set up automatically startup database when the server boot or reboot.

2012-04-27 Thread Alban Hertroys
On 27 April 2012 16:47, leaf_yxj wrote: > David, Thanks for your reminder. My database version is 8.2.15. And My os > platform is Linux 5.5.  Thanks I really appreciate it. Grace There is no such thing as Linux 5.5. But since you're on _a_ Linux distribution (there are many), you'll probably fin

[GENERAL] Re: how to set up automatically startup database when the server boot or reboot.

2012-04-27 Thread leaf_yxj
David, Thanks for your reminder. My database version is 8.2.15. And My os platform is Linux 5.5. Thanks I really appreciate it. Grace -- View this message in context: http://postgresql.1045698.n5.nabble.com/how-to-set-up-automatically-startup-database-when-the-server-boot-or-reboot-tp5670442p56

[GENERAL] Re: how to set up automatically startup database when the server boot or reboot.

2012-04-27 Thread leaf_yxj
David, Thanks for your reminder. My database version is 8.2.15. And My os platform is Linux 5.5. Thanks I really appreciate it. Grace At 2012-04-27 22:38:11,"David Johnston [via PostgreSQL]" wrote: PostgreSQL runs on numerous operating systems. If you do not specify which one you are us

Re: [GENERAL] how to set up automatically startup database when the server boot or reboot.

2012-04-27 Thread yxj
David, Thanks for your reminder. My database version is 8.2.15. And My os platform is Linux 5.5. Thanks I really appreciate it. Grace At 2012-04-27 22:36:51,"David Johnston" wrote: >PostgreSQL runs on numerous operating systems. If you do not specify which >one you are using, as well as h

Re: [GENERAL] how to set up automatically startup database when the server boot or reboot.

2012-04-27 Thread David Johnston
PostgreSQL runs on numerous operating systems. If you do not specify which one you are using, as well as how you went about installing PostgreSQl, no one is going to be able to help you. The PostgreSQL version would probably help as well. David J. On Apr 27, 2012, at 10:26, leaf_yxj wrote:

[GENERAL] How to get the all the activities running during specific time range.Thanks!Plese help!

2012-04-27 Thread leaf_yxj
I was asked to run a report to my boss all the activities running during a specific time range. I want to create a script to run it. I know I can query from pg_stat_activity for my previous postgres version. But I can't find this system table in 8.2.15. Please help. Thanks. Regards. Grace. -- Vie

[GENERAL] how to set up automatically startup database when the server boot or reboot.

2012-04-27 Thread leaf_yxj
My company want to setup automatically startup database. For oracle database, there is a bullitin script and configuration of auto start when the server boot or reboot? Hi Guys, Please help. Thanks. Regards.Grace -- View this message in context: http://postgresql.1045698.n5.nabble.com/how-to-set-

[GENERAL] postgresql standby using pg_archivecleanup don't work

2012-04-27 Thread leo xu
i have one parimary ,two standby. one standby using stream replication connect to primary.another standby using basebackup,then recovery database --cp archivelog from primary using crontab.i want to delete old archivelog from standby.but configure pg_archivecleanup don't work,meantime no error in p

Re: [GENERAL] Difference between speed of 2 functions: SQL+STABLE and PLPGSQL+EXECUTE

2012-04-27 Thread Albe Laurenz
Dmitry Koterov wrote: > For example, I have 2 functions like these: > > CREATE OR REPLACE FUNCTION first(a INTEGER, b INTEGER, ...) RETURNS ... AS > $body$ > ...any SQL which uses $1, $2 etc. arguments, plus LIMIT $3... > $body$ > LANGUAGE 'sql' > STABLE > > > and > > > CREATE OR REPLACE F

Re: [GENERAL] R-tree parallel index creation

2012-04-27 Thread Albe Laurenz
Pavel Iacovlev wrote: > Anyone know if this features is supported in PostgreSQL: > "R-tree index creation can be subdivided into smaller tasks that can be > performed in parallel" ? The PostgreSQL backend does not parallelize anything, including index builds. Yours, Laurenz Albe -- Sent via pg

[GENERAL] Is it possible to call other functions inside plpythonu?

2012-04-27 Thread Frank Lanitz
Hi folks, Just looking for a nice server side solution to implement some fundamental logic for an application. plpythonu looks in this tmers very well as I'm liking the syntax of Python. However, an very old blog post at [1] made me unsure whether really to use it. Is it still (or has it ever been