Re: [GENERAL] create one function to let other user execute vacuum command. got such an error.

2012-03-28 Thread Guillaume Lelarge
On Tue, 2012-03-27 at 18:51 -0700, leaf_yxj wrote: create one function to let other user execute vacuum command. got such an error. Please help. Thanks. Regards . Grace rrp= create function vacuum_f ( tablename char(100)) Returns char(100) AS $$

Re: [GENERAL] create one function to let other user execute vacuum command. got such an error.

2012-03-28 Thread Greg Jaskiewicz
On 28 Mar 2012, at 07:44, Guillaume Lelarge wrote: On Tue, 2012-03-27 at 18:51 -0700, leaf_yxj wrote: create one function to let other user execute vacuum command. got such an error. Please help. Thanks. Regards . Grace rrp= create function vacuum_f ( tablename char(100))

[GENERAL] How to tell if server is in backup mode?

2012-03-28 Thread Toby Corkindale
Hi, I can start and stop backup mode with pg_start_backup() and pg_stop_backup(). Is there any function like pg_is_in_backup() to tell if the mode has been enabled? (I can't find anything in the 9.1 docs) Cheers, Toby -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org)

[GENERAL] user get notification when postgresql database updated

2012-03-28 Thread Albert
I am using javaScript app and PostgreSQL database. I have car_alert as a table contains id (FK of cars table) and userid (FK of users table) each car has a status ( status column in cars table ). car_alert is updating and having new records (car id and userid ) every time user choose car to be

Re: [GENERAL] user get notification when postgresql database updated

2012-03-28 Thread Tom Molesworth
On 28/03/12 12:40, Albert wrote: I am using javaScript app and PostgreSQL database. I have car_alert as a table contains id (FK of cars table) and userid (FK of users table) each car has a status ( status column in cars table ). car_alert is updating and having new records (car id and userid )

Re: [GENERAL] Multiple Slave Failover with PITR

2012-03-28 Thread Albe Laurenz
Ken Brush wrote: I notice that the documentation at: http://wiki.postgresql.org/wiki/Binary_Replication_Tutorial Doesn't contain steps in a Multiple Slave setup for re-establishing them after a slave has become the new master. Based on the documentation, here are the most fail-proof steps

[GENERAL] Query regarding submission on To Do item for psql client psql : Allow processing of multiple -f (file) options

2012-03-28 Thread Vikash3 S
Hi,Would like to submit patch on this TO Do list item which deals with psql client, "psql : Allow processing of multiple -f (file) options ".The code base which I am working on is from postgres 9.1.3 release.But when I diff the code base from git repository, the changes are far different from

[GENERAL] oracle linux

2012-03-28 Thread Gregg Jaskiewicz
They seem to claim up to 70% speed gain. Did anyone proved it, tested it - with PostgreSQL in particular ? They seem to run the same way as RHEL do, ie - you can download it for free, but pay for repo access. (thus updates). -- GJ -- Sent via pgsql-general mailing list

Re: [GENERAL] oracle linux

2012-03-28 Thread Tomas Vondra
On 28 Březen 2012, 16:38, Gregg Jaskiewicz wrote: They seem to claim up to 70% speed gain. Did anyone proved it, tested it - with PostgreSQL in particular ? They do claim a lot of things, and most of the time it's along the lines Let's take this very specific case, let's assume these rather

[GENERAL] what's difference between vacuum analyze and analyze?

2012-03-28 Thread leaf_yxj
I was asked to write a security definer function to make other user can issue vacuum and analyze command? Friends in this community said vacuum doesn't work inside the function or multi command. How about analyze. I know vacuum is something much like oracle shrink which is used to reorganize the

Re: [GENERAL] what's difference between vacuum analyze and analyze?

2012-03-28 Thread Chris Angelico
On Thu, Mar 29, 2012 at 2:24 AM, leaf_yxj leaf_...@163.com wrote: I was asked to write a security definer function to make other user can issue vacuum and analyze command? Friends in this community said vacuum doesn't work inside the function or multi command. How about analyze.  I know vacuum

Re: [GENERAL] oracle linux

2012-03-28 Thread Tom Lane
Tomas Vondra t...@fuzzy.cz writes: On 28 Březen 2012, 16:38, Gregg Jaskiewicz wrote: They seem to claim up to 70% speed gain. Did anyone proved it, tested it - with PostgreSQL in particular ? I really don't expect such difference just due to switching to a different kernel. There's a space

Re: [GENERAL] what's difference between vacuum analyze and analyze?

2012-03-28 Thread Adrian Klaver
On 03/28/2012 08:24 AM, leaf_yxj wrote: I was asked to write a security definer function to make other user can issue vacuum and analyze command? Friends in this community said vacuum doesn't work inside the function or multi command. How about analyze. I know vacuum is something much like

Re: [GENERAL] oracle linux

2012-03-28 Thread Thom Brown
On 28 March 2012 16:30, Tom Lane t...@sss.pgh.pa.us wrote: Tomas Vondra t...@fuzzy.cz writes: On 28 Březen 2012, 16:38, Gregg Jaskiewicz wrote: They seem to claim up to 70% speed gain. Did anyone proved it, tested it - with PostgreSQL in particular ? I really don't expect such difference

Re: [GENERAL] oracle linux

2012-03-28 Thread Tomas Vondra
On 28 Březen 2012, 17:44, Thom Brown wrote: On 28 March 2012 16:30, Tom Lane t...@sss.pgh.pa.us wrote: Tomas Vondra t...@fuzzy.cz writes: On 28 Březen 2012, 16:38, Gregg Jaskiewicz wrote: They seem to claim up to 70% speed gain. Did anyone proved it, tested it - with PostgreSQL in particular

[GENERAL] how to pass the function caller's parameter to inside the function. syntax error at or near $1

2012-03-28 Thread leaf_yxj
I want to create a function which use to truncate the table specified by the caller. I very confused how postgresql pass this parameter into the function : as a superuser to execute : 1) create or replace function d() returns void as $$ analyze; $$ language sql; - this works when i issue

[GENERAL] how postgresql passes the parameter to the function. syntax error near or at $1.

2012-03-28 Thread leaf_yxj
I want to create a function which use to truncate the table specified by the caller. I very confused how postgresql pass this parameter into the function : as a superuser to execute : 1) create or replace function d() returns void as $$ analyze; $$ language sql; - this works when i

Re: [GENERAL] how postgresql passes the parameter to the function. syntax error near or at $1.

2012-03-28 Thread Pavel Stehule
Hello parameter - $n cannot be used on table name or column name position. Some statements - DROP, VACUUM, ANALYZE doesn't support parameters ever. You have to use dynamic SQL in these cases. CREATE OR REPLACE FUNCTION foo(tablename text, value text) RETURNS void AS $$ BEGIN EXECUTE 'insert

Re: [GENERAL] how to pass the function caller's parameter to inside the function. syntax error at or near $1

2012-03-28 Thread Merlin Moncure
On Wed, Mar 28, 2012 at 11:18 AM, leaf_yxj leaf_...@163.com wrote: I want to create a function which use to truncate the table specified by the caller. I very confused how postgresql pass this parameter into the function : as a superuser to execute : 1) create or replace function d()

[GENERAL] Re: how postgresql passes the parameter to the function. syntax error near or at $1.

2012-03-28 Thread leaf_yxj
Pavel, Thanks a lot. Regards. Grace At 2012-03-29 00:27:12,Pavel Stehule [via PostgreSQL] ml-node+s1045698n5601077...@n5.nabble.com wrote: Hello parameter - $n cannot be used on table name or column name position. Some statements - DROP, VACUUM, ANALYZE doesn't support parameters ever.

[GENERAL] Limit the normal user to see system catalog or not??? And create privilege???

2012-03-28 Thread leaf_yxj
For oracle, the normal user can't see all the system catalog. but for postgresql, it looks like all the user can see the system catalog. Should we limit the user read privilege to system catalog? In oracle, the system privilege has create table, create view,create function. For postgresql

[GENERAL] How return a row from a function so it is recognized as such by caller?

2012-03-28 Thread Kenneth Tilton
On version: PostgreSQL 9.1.2 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.5 20110214 (Red Hat 4.4.5-6), 64-bit I get this error (all code at end of post) in pgAdmin: NOTICE: bpa inbound (,now_plus_30) CONTEXT: SQL statement select now_plus_30(NEW) PL/pgSQL function

[GENERAL] system catalog privilege and create privilege ??? how to control them?? thanks

2012-03-28 Thread leaf_yxj
For oracle, the normal user can't see all the system catalog. but for postgresql, it looks like all the user can see the system catalog. Should we limit the user read privilege to system catalog? In oracle, the system privilege has create table, create view,create function. For postgresql

Re: [GENERAL] How return a row from a function so it is recognized as such by caller?

2012-03-28 Thread Kenneth Tilton
First, apologies for being too succinct. I should have reiterated the message subject to provide the context: I am just trying to return a row from a function and have the caller understand it. Oh, and I am a nooby so it is probably something daft. Second, I just tried returning the row as an out

Re: [GENERAL] How return a row from a function so it is recognized as such by caller?

2012-03-28 Thread Kenneth Tilton
On Wed, Mar 28, 2012 at 1:52 PM, Kenneth Tilton ktil...@mcna.net wrote: First, apologies for being too succinct. I should have reiterated the message subject to provide the context: I am just trying to return a row from a function and have the caller understand it. Oh, and I am a nooby so it

Re: [GENERAL] Limit the normal user to see system catalog or not??? And create privilege???

2012-03-28 Thread Scott Marlowe
On Wed, Mar 28, 2012 at 10:54 AM, leaf_yxj leaf_...@163.com wrote: For oracle, the normal user can't see all the system catalog. but for postgresql, it looks like all the user can see the system catalog.  Should we limit the user read privilege to system catalog? Yeah, postgresql tends to

Re: [GENERAL] How return a row from a function so it is recognized as such by caller?

2012-03-28 Thread Merlin Moncure
On Wed, Mar 28, 2012 at 1:11 PM, Kenneth Tilton ktil...@mcna.net wrote: On Wed, Mar 28, 2012 at 1:52 PM, Kenneth Tilton ktil...@mcna.net wrote: First, apologies for being too succinct. I should have reiterated the message subject to provide the context: I am just trying to return a row from

Re: [GENERAL] How return a row from a function so it is recognized as such by caller?

2012-03-28 Thread Kenneth Tilton
On Wed, Mar 28, 2012 at 2:36 PM, Merlin Moncure mmonc...@gmail.comwrote: On Wed, Mar 28, 2012 at 1:11 PM, Kenneth Tilton ktil...@mcna.net wrote: On Wed, Mar 28, 2012 at 1:52 PM, Kenneth Tilton ktil...@mcna.net wrote: First, apologies for being too succinct. I should have reiterated

Re: [GENERAL] How return a row from a function so it is recognized as such by caller?

2012-03-28 Thread Merlin Moncure
On Wed, Mar 28, 2012 at 2:08 PM, Kenneth Tilton ktil...@mcna.net wrote: Thanks, Merlin. Maybe I have some subtle detail wrong. When NEW.warn_time_init is 'now_plus_30' and I have this as my execute statement:         execute NEW.warn_time_init || '($1)' into bpa using NEW; ...I get: your'e

Re: [GENERAL] How return a row from a function so it is recognized as such by caller?

2012-03-28 Thread Kenneth Tilton
On Wed, Mar 28, 2012 at 3:40 PM, Merlin Moncure mmonc...@gmail.com wrote: On Wed, Mar 28, 2012 at 2:08 PM, Kenneth Tilton ktil...@mcna.net wrote: Thanks, Merlin. Maybe I have some subtle detail wrong. When NEW.warn_time_init is 'now_plus_30' and I have this as my execute statement:

Re: [GENERAL] How return a row from a function so it is recognized as such by caller?

2012-03-28 Thread Merlin Moncure
On Wed, Mar 28, 2012 at 2:49 PM, Kenneth Tilton ktil...@mcna.net wrote: Well then I have the other error. With this code:    execute 'select ' || NEW.warn_time_init || '($1)' into bpa using NEW; try this: select * from now_plus_30(NEW) into bpa; :-D merlin -- Sent via pgsql-general mailing

Re: [GENERAL] How return a row from a function so it is recognized as such by caller?

2012-03-28 Thread Kenneth Tilton
On Wed, Mar 28, 2012 at 4:02 PM, Merlin Moncure mmonc...@gmail.com wrote: On Wed, Mar 28, 2012 at 2:49 PM, Kenneth Tilton ktil...@mcna.net wrote: Well then I have the other error. With this code: execute 'select ' || NEW.warn_time_init || '($1)' into bpa using NEW; try this: select *

Re: [GENERAL] Limit the normal user to see system catalog or not??? And create privilege???

2012-03-28 Thread Adrian Klaver
On 03/28/2012 09:54 AM, leaf_yxj wrote: For oracle, the normal user can't see all the system catalog. but for postgresql, it looks like all the user can see the system catalog. Should we limit the user read privilege to system catalog? In oracle, the system privilege has create table, create

[GENERAL] could not read block... how could I identify/fix

2012-03-28 Thread Naoko Reeves
There was a hardware crash. Since then INSERT to one table is failing with the following message: ERROR: could not read block 11857 of relation base/16396/3720450: read only 0 of 8192 bytes ERROR: could not read block 11805 of relation base/16396/3720450: read only 0 of 8192 bytes Similar

[GENERAL] scripted 'pg_ctl start' hangs and never finishes, goes defunct

2012-03-28 Thread Brian Fehrle
Hi all, OS: Linux 64bit PostgreSQL Version: 9.0.5 installed from source. I'm writing up a process that will bring down a warm standby cluster, tarball the data directory, then bring the warm standby back up. I'm having an issue where starting the database with pg_ctl results in the command

Re: [GENERAL] scripted 'pg_ctl start' hangs and never finishes, goes defunct

2012-03-28 Thread Brian Fehrle
Interestingly enough, when using a perl system() vs the qx() or backticks, it doesn't have this behavior. So I've got it working now with some modifications. I'm still interested as why I've seen this behavior, a. from a perl qx() call and b. from an ssh connection from another server. -

[GENERAL] PG Log

2012-03-28 Thread Arvind Singh
I have queries regarding columns in Postgres CSV Log. Following is a sample Logline 2012-03-28 19:25:47.968 IST,postgres,stock_apals,2388,localhost:1898,4f731863.954,6,SET,2012-03-28 19:25:47 IST,2/0,0,LOG,0,QUERY

[GENERAL] why is pg_dump so much smaller than my database?

2012-03-28 Thread Carson Gross
I've got a pretty big database (~30 gigs) and when I do a pg_dump, it ends up only being 2 gigs. The database consists mainly of one very large table (w/ a few varchar columns) which, according to pg_relation_size() is 10 gigs and pg_total_relation_size() is 26 gigs (we need to drop some indexes