Re: [GENERAL] How to lock and unlock table in postgresql

2011-11-16 Thread Alban Hertroys
On 17 Nov 2011, at 7:10, Siva Palanisamy wrote: > If there is a better solution, kindly let me know. > > CREATE OR REPLACE FUNCTION Fun() > RETURNS VOID AS ' > DECLARE > Id INTEGER; > BEGIN > INSERT INTO table1 VALUES (DEFAULT, ''Sample'', DEFAULT); > SELECT MAX(id) I

Re: [GENERAL] How to lock and unlock table in postgresql

2011-11-16 Thread John R Pierce
On 11/16/11 11:16 PM, Siva Palanisamy wrote: Thanks for the solution. If I use currval('sqlname') in a loop of 7 records, what will happen if a record is inserted manually? I guess it will alter the sequences, and wrong values/chain might be introduced in foreign tables in the below functi

Re: [GENERAL] How to lock and unlock table in postgresql

2011-11-16 Thread Siva Palanisamy
Hi John, Thanks for the solution. If I use currval('sqlname') in a loop of 7 records, what will happen if a record is inserted manually? I guess it will alter the sequences, and wrong values/chain might be introduced in foreign tables in the below function. Could you please clarify me on th

Re: [GENERAL] How to lock and unlock table in postgresql

2011-11-16 Thread John R Pierce
On 11/16/11 10:23 PM, John R Pierce wrote: use nextval('seqname') sorry, I meant, currval('seqname') ps. -- john r pierceN 37, W 122 santa cruz ca mid-left coast -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org)

Re: [GENERAL] How to lock and unlock table in postgresql

2011-11-16 Thread John R Pierce
On 11/16/11 10:10 PM, Siva Palanisamy wrote: If there is a better solution, kindly let me know. use nextval('seqname') ... full transactional integrity without any blocking or locking. -- john r pierceN 37, W 122 santa cruz ca mid-left

[GENERAL] How to lock and unlock table in postgresql

2011-11-16 Thread Siva Palanisamy
Hi ya, I've 2 tables: One being the master (table1) and another being the slave (table2). I want to lock table1 until the below function completes, and it should unlock the same at last. Below is my function. Pls guide me on how to apply locking table1 and unlocking the same finally. The scenar

Re: [GENERAL] Is it ever necessary to vacuum a table that only gets inserts/updates?

2011-11-16 Thread Tom Lane
John R Pierce writes: > On 11/16/11 4:24 PM, Jason Buberel wrote: >> Just wondering if there is ever a reason to vacuum a very large table >> (> 1B rows) containing rows that never has rows deleted. > no updates either? To clarify: in Postgres, an "update" means an insert and a delete. So unles

[GENERAL] how could duplicate pkey exist in psql?

2011-11-16 Thread Yan Chunlu
recently I have found several tables has exactly the same pkey, here is the definition: "diggcontent_data_account_pkey" PRIMARY KEY, btree (thing_id, key) the data is like this: 159292 | funnypics_link_point | 41 | num 159292 | funnypics_link_point | 40 | num

Re: [GENERAL] Is it ever necessary to vacuum a table that only gets inserts/updates?

2011-11-16 Thread John R Pierce
On 11/16/11 4:24 PM, Jason Buberel wrote: Just wondering if there is ever a reason to vacuum a very large table (> 1B rows) containing rows that never has rows deleted. Under what circumstance would the table benefit from a vacuum? no updates either? you still want to do a vacuum analyze eve

[GENERAL] Is it ever necessary to vacuum a table that only gets inserts/updates?

2011-11-16 Thread Jason Buberel
Just wondering if there is ever a reason to vacuum a very large table (> 1B rows) containing rows that never has rows deleted. Under what circumstance would the table benefit from a vacuum? -jason -- Jason L. Buberel CTO, Altos Research http://www.altosresearch.com/ 650.603.0907

[GENERAL] hi, firends, what's the difference between using PostgreSQL's share buffer and os's file buffer?

2011-11-16 Thread sunpeng
hi, firends, I have a 64bit 128GB machine, I have two choices: 1. I could set PostgreSQL share_buffer to a large value, such as 100GB, let os uses the remaining 28G memory for file system buffer 2. I also could set PostgreSQL share_buffer to a small value, such as 10GB, l

Re: [GENERAL] Foreign Tables

2011-11-16 Thread Shigeru Hanada
Hi Eliot, 2011/11/17 Eliot Gable : > 1a) Can the foreign tables be written to? For example, I have server1 with > table foo and server2 which does 'create foreign table bar' where bar > references server1.foo. Can server2 write to bar and have it show in > server1.foo? Foreign tables in 9.1 are

Re: [GENERAL] can I show number of records returned by a query in a log?

2011-11-16 Thread hyelluas
Thank you all, I did look at the log , I enabled pg_stat_statements , however it showed the buffers, scans and other info about the query execution - not the records number, any idea how can I get it? I agree that the problem is in qty of the queries, will investigate the client. thank yo

Re: [GENERAL] can I show number of records returned by a query in a log?

2011-11-16 Thread Tomas Vondra
On 17 Listopad 2011, 2:07, hyelluas wrote: > Hello, > > I'm trying to capture amount of data moving from client app to the server > & > back. > The client is executable (c#) gue on windows, server is lunix centOS, > PostgreSQL 8.4. > We see serious performance difference between execution via LAN

Re: [GENERAL] can I show number of records returned by a query in a log?

2011-11-16 Thread Alan Hodgson
On November 16, 2011 05:07:05 PM hyelluas wrote: > I see 900 queries sent by 1 client in 7 min with 1 click on the screen - > does the log show the real thing? The logs show the real thing. Gotta love ORMs. > > > Is it possible to log the number of records returned by that query? I doubt the

[GENERAL] can I show number of records returned by a query in a log?

2011-11-16 Thread hyelluas
Hello, I'm trying to capture amount of data moving from client app to the server & back. The client is executable (c#) gue on windows, server is lunix centOS, PostgreSQL 8.4. We see serious performance difference between execution via LAN & VPN. I enabled the logging and used pgFouine to anal

Re: [GENERAL] How could I find the last modified procedure in the database?

2011-11-16 Thread Tom Lane
Andreas Kretschmer writes: > Dhimant Patel wrote: >> I also created several procedures/functions and now I don't remember the last >> procedure I worked on! - I thought I could always get this from metadata. >> Now I'm stuck - couldn't find this details anywhere in catalog tables! >> Is there any

Re: [GENERAL] pg_dump does not include triggers - should it?

2011-11-16 Thread Tom Lane
Aleksey Tsalolikhin writes: > We just noticed our pg_dumps (generated with > "pg_dump -Fc -n public $our_db_name") does not > include triggers on tables in database $our_db_name. -n restricts the dump to objects in the named schema. It's impossible to evaluate whether there is an issue here, s

Re: [GENERAL] insert locking issue for PG 9.0

2011-11-16 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Ben Chobot Sent: Wednesday, November 16, 2011 5:48 PM To: pgsql-general General Subject: [GENERAL] insert locking issue for PG 9.0 Our application has a table that looks lik

[GENERAL] pg_dump does not include triggers - should it?

2011-11-16 Thread Aleksey Tsalolikhin
Hi, We are using Postgres 8.4.8 and it is a very fine database. We just noticed our pg_dumps (generated with "pg_dump -Fc -n public $our_db_name") does not include triggers on tables in database $our_db_name. Should it? (We'd like it to, we are counting on pg_dump to backup all our data, in

[GENERAL] insert locking issue for PG 9.0

2011-11-16 Thread Ben Chobot
Our application has a table that looks like: create table jobs ( id int, first boolean ); What we need is for the app to be able to shove data into jobs with an assigned id, and guarantee that first is only true for one id. In other words, we could easily enforce what we want b

[GENERAL] Transaction wraparound problem due to wrong datfrozenxid?

2011-11-16 Thread Arctic Toucan
I ran into a rather unusual problem today where Postgres brought down a database to avoid transaction wraparound in a situation where it doesn't appear that it should have. The error in the log is explicit enough... Nov 16 04:00:03 SRP1 postgres[58101]: [1-1] FATAL: database is not accepting

Re: [GENERAL] Foreign Tables

2011-11-16 Thread Guillaume Lelarge
On Wed, 2011-11-16 at 13:38 -0500, Eliot Gable wrote: > I am working on a reporting project where I need to generate a report based > on data from several different network appliances. Each appliance runs a > PostgreSQL database which houses all of the information for the appliance. > Further, ther

Re: [BULK] Re: [GENERAL] Streaming Replication woes

2011-11-16 Thread Sean Patronis
Konstantin, Just back from some time off and read this reply. This was exactly the issue. The superuser "postgres" did not have this role since this was a dump/restore/upgrade from postgres 8.4. I just created a new Role and user, and it all worked! Thanks! --Sean On 11/06/2011 06:41 P

Re: [GENERAL] all non-PK columns from information schema

2011-11-16 Thread Adam Cornett
On Tue, Nov 15, 2011 at 11:29 AM, Richard Broersma < richard.broer...@gmail.com> wrote: > On Tue, Nov 15, 2011 at 8:00 AM, Tarlika Elisabeth Schmitz > wrote: > > Interesting. I have previously used the information_schema for similar > > queries. > > > > What are the pros and cons for using either

[GENERAL] Foreign Tables

2011-11-16 Thread Eliot Gable
I am working on a reporting project where I need to generate a report based on data from several different network appliances. Each appliance runs a PostgreSQL database which houses all of the information for the appliance. Further, there are dozens of triggers in the database which fire when vario

Re: [GENERAL] How could I find the last modified procedure in the database?

2011-11-16 Thread Andreas Kretschmer
Dhimant Patel wrote: > I have postgres (PostgreSQL) 9.0.3 running. > I also created several procedures/functions and now I don't remember the last > procedure I worked on! - I thought I could always get this from metadata. > > Now I'm stuck - couldn't find this details anywhere in catalog tables

[GENERAL] Postgres windows user

2011-11-16 Thread Christine Penner
We have a couple of clients having problems with the windows user that the postgres service uses to run changing passwords. They fixed the windows user password and it worked for a bit and then got reset again. Client computers are all Windows XP SP3 and the server is Windows Server 2003 stand

Re: [GENERAL] How could I find the last modified procedure in the database?

2011-11-16 Thread John R Pierce
On 11/16/11 8:00 AM, Dhimant Patel wrote: I have postgres *(PostgreSQL) 9.0.3 running.* I also created several procedures/functions and now I don't remember the last procedure I worked on! - I thought I could always get this from metadata. Now I'm stuck - couldn't find this details anywhere i

[GENERAL] How could I find the last modified procedure in the database?

2011-11-16 Thread Dhimant Patel
I have postgres *(PostgreSQL) 9.0.3 running.* I also created several procedures/functions and now I don't remember the last procedure I worked on! - I thought I could always get this from metadata. Now I'm stuck - couldn't find this details anywhere in catalog tables! Is there anyway I can get th

Re: [GENERAL] CLONE DATABASE (with copy on write?)

2011-11-16 Thread Clark C. Evans
After this discussion and the spin-off discussion on the hacker list, I wanted to summarize my understanding. So, what I asked for is relatively inexpensive way to make copies of an existing database for staging, upgrade tests, and other activities. There are two approaches to this sort of replic

Re: [GENERAL] syntax highlighting in emacs after \e in psql

2011-11-16 Thread MikeW
> (add-to-list 'auto-mode-alist >              '("/psql.edit.[0-9]+\\'" . sql-mode)) Thanks, Peter! That's exactly what I was looking for. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] PostgreSQL-Slony error?

2011-11-16 Thread kyp404
Hi all, We have a master and a slave DB server (both PostgreSQL 8.3, Slony 2.0.1). Maybe we were hasty, because we delete ~18 million rows from a table on master with one SQL command. Slony log and transfer jobs/transactions to the slave node, but on the slave node the slony can't do this job. Slo

Re: [GENERAL] partitioning a dataset + employing hysteresis condition

2011-11-16 Thread Amit Dor-Shifer
On Wed, Nov 16, 2011 at 4:58 PM, David Johnston wrote: > On Nov 15, 2011, at 15:28, Gavin Flower > wrote: > > On 14/11/11 18:35, Amit Dor-Shifer wrote: > > > On Mon, Nov 14, 2011 at 4:29 PM, Amit Dor-Shifer < > amit.dor.shi...@gmail.com> wrote: > >> Hi, >> I've got this table: >> create table ph

Re: [GENERAL] how to drop function?

2011-11-16 Thread Ivan Sergio Borgonovo
On Wed, 16 Nov 2011 09:17:45 +0100 Thomas Kellerer wrote: > Ivan Sergio Borgonovo, 16.11.2011 01:01: > > test=# begin; > > create or replace function process_table ( > > action TEXT, v_table_name varchar(100) > > ) RETURNS BOOLEAN > > AS $$ > > DECLARE > > > > BEGIN > > return t

Re: [GENERAL] how to drop function?

2011-11-16 Thread Thomas Kellerer
Ivan Sergio Borgonovo, 16.11.2011 01:01: test=# begin; create or replace function process_table ( action TEXT, v_table_name varchar(100) ) RETURNS BOOLEAN AS $$ DECLARE BEGIN return true; END; $$ LANGUAGE plpgsql; drop function process_table ( action TEXT, v_table_nam

Re: [GENERAL] how to drop function?

2011-11-16 Thread Ivan Sergio Borgonovo
On Tue, 15 Nov 2011 18:48:00 -0700 "J.V." wrote: > the drop function works when running from a pgAdmin III Sql window > > but when I try to do from the command line and script it: > psql -h $PGHOST -p $PGPORT -d $PGDATABASE -U $PGUSER -c > "*drop function *" > > the above fails. > It