Re: [GENERAL] restore a server backup

2011-02-28 Thread Vibhor Kumar
On Mar 1, 2011, at 12:07 PM, Malm Paul wrote: > Hi, I've used PgAdmin III to store a server backup. But I'm not able to > restore it. > > Please, could any one tell me how to do it? Im using version 1.10 > /Paul Following link would help for restoring backup: http://www.pgadmin.org/docs/1.10

[GENERAL] new databases using a template.

2011-02-28 Thread Malm Paul
Hi, I'm trying to create a new database by using a template database. But it is not possible. The error code is that some one is using the template, but no one is using it. I'm using PgAdmin III ver 1.1.0. Has some one seen something like this? /Paul From: pgsql

[GENERAL] restore a server backup

2011-02-28 Thread Malm Paul
Hi, I've used PgAdmin III to store a server backup. But I'm not able to restore it. Please, could any one tell me how to do it? Im using version 1.10 /Paul

Re: [GENERAL] database is bigger after dump/restore - why? (60 GB to 109 GB)

2011-02-28 Thread Aleksey Tsalolikhin
On Sun, Feb 27, 2011 at 2:52 AM, Alban Hertroys wrote: Thank you for your kind replies. > I noticed in your table definition that you seem to store timestamps in > text-fields. Restoring those from text-fields shouldn't make any difference, > but perhaps your locales are set up differently betw

Re: [GENERAL] Binary params in libpq

2011-02-28 Thread Craig Ringer
On 28/02/2011 10:42 PM, Merlin Moncure wrote: Actually, this has always been a compile time option on the server as far as i remember and there is protocol support for it -- libpq tells you how it has been set...you've always had to deal with this (libpqtypes, which I've mentioned several times

Re: [GENERAL] Lock ACCESS EXCLUSIVE and Select question !

2011-02-28 Thread David Johnston
As mentioned SELECT FOR UPDATE is likely your best option. As for an algorithm if you can find an airline or sporting event case study those two domains have this problem solved already. Barring that the following comes to mind. Create a record for every "seat" that needs to be sold. You can l

Re: [GENERAL] slow building index and reference after Sybase to Pg

2011-02-28 Thread Andres Freund
Hi, On Wednesday 23 February 2011 19:31:58 Gary Fu wrote: > I'm testing on converting a big Sybase db to Pg. It took about 45 hours > to convert all sybase tables (bcp) to Pg (copy) without index and > reference. After that I built the index (one by one, sequentially) and > it took about 25 hour

Re: [GENERAL] slow building index and reference after Sybase to Pg

2011-02-28 Thread Joshua D. Drake
On Mon, 2011-02-28 at 18:16 -0500, Gary Fu wrote: > > > It is set to 12GB. > > Do you recommend to set fsync to off ? It needs to restart the server. Not in production. JD > > Thanks, > Gary > -- PostgreSQL.org Major Contributor Command Prompt, Inc: http://www.commandprompt.com/ - 509.416

Re: [GENERAL] slow building index and reference after Sybase to Pg

2011-02-28 Thread Gary Fu
On 02/28/11 17:56, Andres Freund wrote: Hi, On Saturday, February 26, 2011 12:11:19 AM Gary Fu wrote: wal_buffers = 16MB sensible checkpoint_segments = 256 A setting that high seems unlikely to be beneficial... I suggest you configure log_checkpoints to monitor this. effective_cache_size

Re: [GENERAL] Lock ACCESS EXCLUSIVE and Select question !

2011-02-28 Thread Andrew Sullivan
On Mon, Feb 28, 2011 at 05:39:07PM -0500, Alan Acosta wrote: > But i have a new problem there, i have no rows for update, i create new rows > when the seats are sold, cause rarely the database knows the capacity of the > bus, number of seats, even some bus doesn't have seat number 4 for example > :

Re: [GENERAL] slow building index and reference after Sybase to Pg

2011-02-28 Thread Andres Freund
Hi, On Saturday, February 26, 2011 12:11:19 AM Gary Fu wrote: > wal_buffers = 16MB sensible > checkpoint_segments = 256 A setting that high seems unlikely to be beneficial... I suggest you configure log_checkpoints to monitor this. > effective_cache_size = 30GB Not likely to matter in this case.

Re: [GENERAL] Lock ACCESS EXCLUSIVE and Select question !

2011-02-28 Thread Adrian Klaver
On Monday, February 28, 2011 2:39:07 pm Alan Acosta wrote: > But i have a new problem there, i have no rows for update, i create new > rows when the seats are sold, cause rarely the database knows the capacity > of the bus, number of seats, even some bus doesn't have seat number 4 for > example So

Re: [GENERAL] slow building index and reference after Sybase to Pg

2011-02-28 Thread Gary Fu
On 02/28/11 17:32, Andy Colson wrote: Here are the more test results on the 3rd ref and parallel on 2nd and 3rd references: 325 mins on FK_FM_ALL_REF_FILE (334 mins previous) parallel results on 2nd and 3rd references: (much worse on 2nd ref) Here are some information on my system: 1:

Re: [GENERAL] Transactions and ID's generated by triggers

2011-02-28 Thread Alban Hertroys
On 28 Feb 2011, at 22:07, Andre Lopes wrote: > Hi, > > Thanks for the reply. > > How can I user the RETURNING without pl/sql? My PostgreSQL version is 8.3 > > Can you give me some example? http://www.postgresql.org/docs/8.3/interactive/sql-insert.html Most notably the last example on that pag

Re: [GENERAL] Lock ACCESS EXCLUSIVE and Select question !

2011-02-28 Thread Bosco Rama
Alan Acosta wrote: > But i have a new problem there, i have no rows for update, i create new rows > when the seats are sold, cause rarely the database knows the capacity of the > bus, number of seats, even some bus doesn't have seat number 4 for example > :p. So i cannot SELECT FOR UPDATE no existe

Re: [GENERAL] Lock ACCESS EXCLUSIVE and Select question !

2011-02-28 Thread Alan Acosta
But i have a new problem there, i have no rows for update, i create new rows when the seats are sold, cause rarely the database knows the capacity of the bus, number of seats, even some bus doesn't have seat number 4 for example :p. So i cannot SELECT FOR UPDATE no existent rows, but i still need t

Re: [GENERAL] slow building index and reference after Sybase to Pg

2011-02-28 Thread Andy Colson
Here are the more test results on the 3rd ref and parallel on 2nd and 3rd references: 325 mins on FK_FM_ALL_REF_FILE (334 mins previous) parallel results on 2nd and 3rd references: (much worse on 2nd ref) Here are some information on my system: 1:07pm 20 gfu@moddblads:/dump/gfu> free -m

Re: [GENERAL] Lock ACCESS EXCLUSIVE and Select question !

2011-02-28 Thread Andrew Sullivan
On Mon, Feb 28, 2011 at 05:13:11PM -0500, Alan Acosta wrote: > I really appreciate your help Andrew, and yep, i already starto to feel some > pain lol. I suppose is true but is better to ask, SELECT FOR UPDATE is > faster than LOCK ? SELECT FOR UPDATE locks the row you're trying to lock. So it's

Re: [GENERAL] Lock ACCESS EXCLUSIVE and Select question !

2011-02-28 Thread Alan Acosta
I really appreciate your help Andrew, and yep, i already starto to feel some pain lol. I suppose is true but is better to ask, SELECT FOR UPDATE is faster than LOCK ? Thanks for the recommendations, i will check them ^_^ Cheers, Alan Acosta On Mon, Feb 28, 2011 at 4:28 PM, Andrew Sullivan wrote

Re: [GENERAL] slow building index and reference after Sybase to Pg

2011-02-28 Thread Gary Fu
On 02/25/11 18:11, Gary Fu wrote: On 02/25/11 17:22, Andy Colson wrote: On 2/23/2011 12:31 PM, Gary Fu wrote: Hi, I'm testing on converting a big Sybase db to Pg. It took about 45 hours to convert all sybase tables (bcp) to Pg (copy) without index and reference. After that I built the index (o

Re: [GENERAL] Lock ACCESS EXCLUSIVE and Select question !

2011-02-28 Thread Andrew Sullivan
On Mon, Feb 28, 2011 at 04:12:30PM -0500, Alan Acosta wrote: > My application is trying to generate a numbered place for a client inside a > bus, and to avoid to sell the place number "5" to two people, so i need to > avoid that two sellers to sell the same place to same time, when i start my > pr

Re: [GENERAL] Lock ACCESS EXCLUSIVE and Select question !

2011-02-28 Thread Alan Acosta
My threads use each one different conecctions, so the transactions are different, may be my bad English doesn't help to much, sorry for that ! My application is trying to generate a numbered place for a client inside a bus, and to avoid to sell the place number "5" to two people, so i need to avoi

Re: [GENERAL] Transactions and ID's generated by triggers

2011-02-28 Thread Andre Lopes
Hi, Thanks for the reply. How can I user the RETURNING without pl/sql? My PostgreSQL version is 8.3 Can you give me some example? Best Regards, On Mon, Feb 28, 2011 at 7:00 PM, Alban Hertroys wrote: > On 28 Feb 2011, at 24:37, David Johnston wrote: > >> Using pl/pgsql you can: > > You don'

Re: [GENERAL] Lock ACCESS EXCLUSIVE and Select question !

2011-02-28 Thread Andrew Sullivan
On Mon, Feb 28, 2011 at 03:32:08PM -0500, Alan Acosta wrote: > your recommendation about to use SHARE mode, but in > http://www.postgresql.org/docs/8.3/static/explicit-locking.html i see that > SHARE mode doesn't lock against itself, so, another thread using the same > mode will be able to access t

Re: [GENERAL] Full Vacuum/Reindex vs autovacuum

2011-02-28 Thread Andrew Sullivan
On Mon, Feb 28, 2011 at 01:48:30PM -0600, Jason Long wrote: > I stopped doing the nightly vacuum full and reindex. After 3 months > some queries would not complete within 2 minutes. Normally these take > less than 5 seconds. I tried vacuum without full and reindex, but the > problem was still t

Re: [GENERAL] Lock ACCESS EXCLUSIVE and Select question !

2011-02-28 Thread Alan Acosta
Andrew, thank you very much for reply ! I already update my bookmark for 8.3 which is my current version, http://www.postgresql.org/docs/8.3/static/explicit-locking.html, i see new things here, like a comparative table. Yep, seems like ACCESS EXCLUSIVE is a bad idea, at least now :p ! i check you

Re: [GENERAL] Full Vacuum/Reindex vs autovacuum

2011-02-28 Thread Jason Long
On Mon, 2010-11-08 at 16:23 -0700, Scott Marlowe wrote: > On Mon, Nov 8, 2010 at 3:42 PM, Jason Long wrote: > > On Mon, 2010-11-08 at 14:58 -0700, Scott Marlowe wrote: > >> On Mon, Nov 8, 2010 at 11:50 AM, Jason Long wrote: > >> > I currently have Postgres 9.0 install after an upgrade. My databa

Re: [GENERAL] Full Vacuum/Reindex vs autovacuum

2011-02-28 Thread Jason Long
On Mon, 2010-11-08 at 16:23 -0700, Scott Marlowe wrote: > On Mon, Nov 8, 2010 at 3:42 PM, Jason Long wrote: > > On Mon, 2010-11-08 at 14:58 -0700, Scott Marlowe wrote: > >> On Mon, Nov 8, 2010 at 11:50 AM, Jason Long wrote: > >> > I currently have Postgres 9.0 install after an upgrade. My databa

Re: [GENERAL] regexp problem

2011-02-28 Thread Merlin Moncure
On Thu, Feb 24, 2011 at 2:12 PM, Gauthier, Dave wrote: > Yup, that did it.  And you're right, you don't need to escape the '.'. > > So the extra \ is needed because of the single quotes string. > A.  :-) Yes...highly advise dollar quoting whenever dealing with regex. merlin -- Sent

Re: [GENERAL] Thoroughly confused about time zones

2011-02-28 Thread Martijn van Oosterhout
On Mon, Feb 28, 2011 at 10:06:28AM -0500, Rob Richardson wrote: > Our application stores the times at which several events happened, and > we need to be able to calculate the elapsed time between events. > Currently, the times are stored as timestamps without time zone, in both > local and UTC time

Re: [GENERAL] Transactions and ID's generated by triggers

2011-02-28 Thread Alban Hertroys
On 28 Feb 2011, at 24:37, David Johnston wrote: > Using pl/pgsql you can: You don't need pl/pgsql for that. You can return the resultset of the first insert into a client-side variable (while still making use of the RETURNING-clause of course). Of course, the benefit of using pl/pgsql for this

Re: [GENERAL] Lock ACCESS EXCLUSIVE and Select question !

2011-02-28 Thread Andrew Sullivan
On Mon, Feb 28, 2011 at 12:43:58PM -0500, Alan Acosta wrote: > I'm using lock with ACCESS EXCLUSIVE in several of my tables to assure that > only one process write in those tables at same time Why are you doing that? It sounds like a bad idea to me. But anyway, I believe that the SHARE lock (wh

[GENERAL] Lock ACCESS EXCLUSIVE and Select question !

2011-02-28 Thread Alan Acosta
Hi everyone ! I'm using lock with ACCESS EXCLUSIVE in several of my tables to assure that only one process write in those tables at same time, this is blocking my SELECT, and this is what i want, but, deadlocks start to showing more and more in my logs when SELECTS failt to get his Share Lock mode

Re: [GENERAL] Permission denied when inserting

2011-02-28 Thread Adrian Klaver
On Monday, February 28, 2011 9:15:27 am Tom Lane wrote: > Adrian Klaver writes: > > I understand, yet I don't:) Seems I have a misconception of the the > > FOREIGN KEY process. The error was on the query below, which I am > > taking is the query you refer to above. To me it looks like a look up >

Re: [GENERAL] Permission denied when inserting

2011-02-28 Thread Tom Lane
Adrian Klaver writes: > I understand, yet I don't:) Seems I have a misconception of the the > FOREIGN KEY process. The error was on the query below, which I am > taking is the query you refer to above. To me it looks like a look up > from the referencing(permout) table to the referenced(out2cp) on

Re: [GENERAL] Permission denied when inserting

2011-02-28 Thread Adrian Klaver
On Monday, February 28, 2011 8:17:07 am Tom Lane wrote: > Adrian Klaver writes: > > On Monday, February 28, 2011 8:02:53 am Tom Lane wrote: > >> Right. But actually, that query will be run with the permissions of the > >> owner of the table, so it's that user (not necessarily the one doing the >

Re: [GENERAL] Permission denied when inserting (SOLVED)

2011-02-28 Thread Borek Lupomesky
On 28.2.2011 17:02, Tom Lane wrote: you don't have permissions to verify the FK constraint. the query you see in the error is exactly this test. Right. But actually, that query will be run with the permissions of the owner of the table, so it's that user (not necessarily the one doing the INS

Re: [GENERAL] Permission denied when inserting

2011-02-28 Thread Tom Lane
Adrian Klaver writes: > On Monday, February 28, 2011 8:02:53 am Tom Lane wrote: >> Right. But actually, that query will be run with the permissions of the >> owner of the table, so it's that user (not necessarily the one doing the >> INSERT) who lacks permissions. > The OP listed the permissions

[GENERAL] FTS and words near one another

2011-02-28 Thread Arturo Perez
Hi all, Is there currently anyway in 9.0 to use FTS to search for words that are next to each other? For example, I want to search for Abraham next to Lincoln and ignore things like 'Abraham Johnson who lives in Lincoln Nebraska'. tia, arturo -- Sent via pgsql-general mailing list (pgsql-gen

Re: [GENERAL] Permission denied when inserting

2011-02-28 Thread Adrian Klaver
On Monday, February 28, 2011 8:02:53 am Tom Lane wrote: > Vick Khera writes: > > On Mon, Feb 28, 2011 at 9:37 AM, Borek Lupomesky wrote: > >>"permout_site_fkey" FOREIGN KEY (site, cp) REFERENCES out2cp(site, > >> cp) ON DELETE CASCADE > > > > you don't have permissions to verify the FK const

Re: [GENERAL] Binary params in libpq

2011-02-28 Thread Daniele Varrazzo
On Mon, Feb 28, 2011 at 2:42 PM, Merlin Moncure wrote: > On Sun, Feb 27, 2011 at 7:39 PM, Craig Ringer >> AFAIK, the `timestamp' type moved from a floating-point to an integer >> representation internally, which would've affected the binary protocol >> representation. That was even a compile-time

Re: [GENERAL] Permission denied when inserting

2011-02-28 Thread Tom Lane
Vick Khera writes: > On Mon, Feb 28, 2011 at 9:37 AM, Borek Lupomesky wrote: >>    "permout_site_fkey" FOREIGN KEY (site, cp) REFERENCES out2cp(site, cp) ON >> DELETE CASCADE > you don't have permissions to verify the FK constraint. the query you > see in the error is exactly this test. Right.

Re: [GENERAL] Issues with imported blobs from Postgres 8 to 9

2011-02-28 Thread Tom Lane
Mahdi Mankai writes: > I created a database dumb using pg_dump on Postgres 8.3.6. After that I tried > to import the same database into a Postgres 9.0 install. Everything worked > fine except some image blobs. Some of them seem to be corrupt. I doubt this is a bytea_escape problem. In the firs

Re: [GENERAL] NullPointerException when making a getCapabilities request

2011-02-28 Thread Tom Lane
=?ISO-8859-1?Q?=C1lvaro_Plata?= writes: > When trying to make a getCapabilities request (using Postgresql8.4 and > java6) I get this NullPointerException: You should probably report this on pgsql-jdbc, not here. regards, tom lane -- Sent via pgsql-general mailing list

Re: [GENERAL] Permission denied when inserting

2011-02-28 Thread Adrian Klaver
On Monday, February 28, 2011 6:37:51 am Borek Lupomesky wrote: > Hello, > > I have a database app that worked fine until we reinstalled the > server with the related DB dump and restore. Most of the stuff works > fine after the reinstall, but one particular insert gives very cryptic > (for me)

Re: [GENERAL] Permission denied when inserting

2011-02-28 Thread Vibhor Kumar
On Feb 28, 2011, at 8:07 PM, Borek Lupomesky wrote: > spam=> INSERT INTO permout ( site, cp, owner, descr, creat_who ) VALUES ( > 'vin', '3035.1', 'borelupo', 'test', 'borelupo' ); > ERROR: permission denied for relation out2cp > CONTEXT: SQL statement "SELECT 1 FROM ONLY "public"."out2cp" x W

Re: [GENERAL] Permission denied when inserting

2011-02-28 Thread Bill Moran
In response to Rob Sargent : > On 02/28/2011 07:37 AM, Borek Lupomesky wrote: > > Hello, > > > >I have a database app that worked fine until we reinstalled the > > server with the related DB dump and restore. Most of the stuff works > > fine after the reinstall, but one particular insert give

Re: [GENERAL] Permission denied when inserting

2011-02-28 Thread Vick Khera
On Mon, Feb 28, 2011 at 9:37 AM, Borek Lupomesky wrote: >    "permout_site_fkey" FOREIGN KEY (site, cp) REFERENCES out2cp(site, cp) ON > DELETE CASCADE > you don't have permissions to verify the FK constraint. the query you see in the error is exactly this test. -- Sent via pgsql-general mailin

Re: [GENERAL] Thoroughly confused about time zones

2011-02-28 Thread Scott Ribe
On Feb 28, 2011, at 8:18 AM, Rob Richardson wrote: > But when I tried this: > > select cast (extract(epoch from ('2010-3-14 12:00'::timestamptz - '2010-3-13 > 12:00'::timestamptz)) as integer) / 60 / 60 > > I got 23, showing that even if I did not specify what time zone I’m talking > about,

Re: [GENERAL] Permission denied when inserting

2011-02-28 Thread Rob Sargent
On 02/28/2011 07:37 AM, Borek Lupomesky wrote: > Hello, > >I have a database app that worked fine until we reinstalled the > server with the related DB dump and restore. Most of the stuff works > fine after the reinstall, but one particular insert gives very cryptic > (for me) message: > > sp

[GENERAL] Issues with imported blobs from Postgres 8 to 9

2011-02-28 Thread Mahdi Mankai
Hi, I created a database dumb using pg_dump on Postgres 8.3.6. After that I tried to import the same database into a Postgres 9.0 install. Everything worked fine except some image blobs. Some of them seem to be corrupt. OS: Mac OS X Server 10.5.8. The same issue happened on Mac OS X client 10.6

Re: [GENERAL] Thoroughly confused about time zones

2011-02-28 Thread Rob Richardson
I think maybe I'm making things much more difficult than they need to be. I tried this: select cast (extract(epoch from ('2010-3-14 12:00'::timestamp - '2010-3-13 12:00'::timestamp)) as integer) / 60 / 60 and got 24. The difference between timestamps without time zones is 24 hours, even t

Re: [GENERAL] Thoroughly confused about time zones

2011-02-28 Thread Scott Ribe
On Feb 28, 2011, at 8:06 AM, Rob Richardson wrote: > But if PostgreSQL doesn’t store time zones internally, then that difference > is going to be 24 hours, which doesn’t help me. No, postgres stores timestamptz as UTC, so that calculation will work exactly like you want. -- Scott Ribe scott_r

[GENERAL] Permission denied when inserting

2011-02-28 Thread Borek Lupomesky
Hello, I have a database app that worked fine until we reinstalled the server with the related DB dump and restore. Most of the stuff works fine after the reinstall, but one particular insert gives very cryptic (for me) message: spam=> INSERT INTO permout ( site, cp, owner, descr, creat_w

[GENERAL] Thoroughly confused about time zones

2011-02-28 Thread Rob Richardson
Greetings! Our application stores the times at which several events happened, and we need to be able to calculate the elapsed time between events. Currently, the times are stored as timestamps without time zone, in both local and UTC times. Elapsed time calculations are based on the UTC times.

Re: [GENERAL] Hot Standby - ERROR: canceling statement due to conflict with recovery

2011-02-28 Thread Merlin Moncure
On Sun, Feb 27, 2011 at 1:57 PM, Sean Laurent wrote: > Right. I read all of that. I guess I just assumed it was possible to create > a snapshot on the standby so that a longer running on the standby could > complete. In particular, I was really hoping to run database dumps against > the standby, n

Re: [GENERAL] Binary params in libpq

2011-02-28 Thread Merlin Moncure
On Sun, Feb 27, 2011 at 7:39 PM, Craig Ringer wrote: > On 28/02/2011 7:48 AM, Merlin Moncure wrote: > >>> How stable is the binary representation for the PostgreSQL types? We >>> may just pass bytea data in binary format and pass everything else as >>> text parameters, or pass different types too

Re: [GENERAL] Transactions and ID's generated by triggers

2011-02-28 Thread Andre Lopes
Thanks for the reply. I will try the code tonight. Best Regards, On Sun, Feb 27, 2011 at 11:37 PM, David Johnston wrote: > Using pl/pgsql you can: > > DECLARE idordinal type; > BEGIN > INSERT INTO tdir_uris_files RETURNING id_ordinal INTO idordinal; > INSERT INTO tdir_uris_files_details

[GENERAL] NullPointerException when making a getCapabilities request

2011-02-28 Thread Álvaro Plata
Hi all, When trying to make a getCapabilities request (using Postgresql8.4 and java6) I get this NullPointerException: description: The server encountered an internal error () that prevented it from fulfilling this request. exception: java.lang.NullPointerException java.util.ArrayList.(Arra