Re: [GENERAL] Problem with restoring from backup on 9.0.2

2011-01-27 Thread Thom Brown
On 27 December 2010 18:24, hubert depesz lubaczewski wrote: > hi, > this mail will be relatively long, because I need to explain in details > what/how I do. > > Simple summary: > > when restoring from hot backup, with out xlogs in pg_xlog/, but instead > using recovery.conf to get xlogs from wal a

Re: [GENERAL] resizing a varchar column on 8.3.8

2011-01-27 Thread Jon Hoffman
This was originally discussed on this list here: http://postgresql.1045698.n5.nabble.com/Smartest-way-to-resize-a-column-td1915892.html Tom Lane suggested doing the resize in a BEGIN block at least to verify that "\d tablename" reflects the catalog update. - Jon On Thu, Jan 27, 2011 at 3:39 PM,

Re: [GENERAL] Adding ddl audit trigger

2011-01-27 Thread Lawrence Cohan
We'll do that - thanks again. -Original Message- From: Scott Marlowe [mailto:scott.marl...@gmail.com] Sent: January-27-11 3:58 PM To: Lawrence Cohan Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Adding ddl audit trigger On Thu, Jan 27, 2011 at 1:47 PM, Lawrence Cohan wrote: > T

Re: [GENERAL] resizing a varchar column on 8.3.8

2011-01-27 Thread Scott Marlowe
On Thu, Jan 27, 2011 at 1:57 PM, Jon Hoffman wrote: > This was originally discussed on this list > here: http://postgresql.1045698.n5.nabble.com/Smartest-way-to-resize-a-column-td1915892.html > Tom Lane suggested doing the resize in a BEGIN block at least to verify that > "\d tablename" reflects t

Re: [GENERAL] Adding ddl audit trigger

2011-01-27 Thread Scott Marlowe
On Thu, Jan 27, 2011 at 1:47 PM, Lawrence Cohan wrote: > That should do it for our dev environment however on production systems it > would be a little bit harder (quite a few hops/approval/restore) to get to > and grep the log files. Sounds like you need a process to scrub logs and ship them o

Re: [GENERAL] Adding ddl audit trigger

2011-01-27 Thread Lawrence Cohan
That should do it for our dev environment however on production systems it would be a little bit harder (quite a few hops/approval/restore) to get to and grep the log files. Many thanks for the suggestion, Lawrence Cohan. -Original Message- From: Scott Marlowe [mailto:scott.marl...@gma

Re: [GENERAL] resizing a varchar column on 8.3.8

2011-01-27 Thread Scott Marlowe
It's one of those "It's perfectly safe, as long as nothing goes wrong" types of things. It should work, but I'd certainly play on a test server first. And if something goes wrong in the right way, you might not even know it for a while. But generally, it's pretty common to do this one hackish th

Re: [GENERAL] resizing a varchar column on 8.3.8

2011-01-27 Thread Jon Hoffman
Hi, I was able to do this without any issues, though I don't have any views. - Jon On Thu, Jan 27, 2011 at 9:52 AM, Emi Lu wrote: > On 01/15/2011 04:22 PM, Jon Hoffman wrote: > >> Hi, >> >> I found a post with some instructions for resizing without locking up >> the table, but would like to ge

Re: [GENERAL] Adding ddl audit trigger

2011-01-27 Thread Scott Marlowe
On Wed, Jan 26, 2011 at 2:29 PM, Lawrence Cohan wrote: > Trying to get some DDL auditing in a development environment by adding > triggers to pg_proc, pg_class,pg_type,pg_trigger and getting the following > error: Yep, can't do it just yet. For now you've got log_statement='ddl'; which can be

Re: [GENERAL] Adding ddl audit trigger

2011-01-27 Thread Chris Browne
guilla...@lelarge.info (Guillaume Lelarge) writes: > Le 26/01/2011 23:13, Tom Lane a écrit : >> Guillaume Lelarge writes: >>> Le 26/01/2011 22:29, Lawrence Cohan a écrit : All I need is to at least be able and save a userid(current_user), >>> timestamp, action, and the name of the object and

Re: [GENERAL] Dumpall without OID

2011-01-27 Thread Adrian Klaver
On 01/27/2011 04:52 AM, Girts Laudaks wrote: Hi, What could be the possible damage if a database is migraged without the -o (OID) option? Integrity of data? User OIDs are deprecated,so the main problem is whether you are currently using them as foreign keys. If you do not specify the -o swit

Re: [GENERAL] temporal period type and select distinct gives equality error

2011-01-27 Thread Arturo Perez
In article <1296066333.11513.364.camel@jdavis>, Jeff Davis wrote: > On Wed, 2011-01-26 at 09:27 -0500, Arturo Perez wrote: > > > and yet when I do a select distinct with a join I get > > > > > > QueryLogger - *** error. > > > org.postgresql.util.PSQLException: ERROR: could not identify an equal

[GENERAL] Dumpall without OID

2011-01-27 Thread Girts Laudaks
Hi, What could be the possible damage if a database is migraged without the -o (OID) option? Integrity of data? What are the options to solve this problem if it is migrated this way? Shouldn't pg_dumpall work like an exact copy of db? What could have gone wrong if only these commands were used?

Re: [GENERAL] Select query ignores index on large table

2011-01-27 Thread Alban Hertroys
On 27 Jan 2011, at 15:04, Michael Kemanetzis wrote: > Hello, I'm experiencing a strange behavior running a simple select query on a > table that has about 12 million rows. Specifically, changing the "LIMIT" > value seems to change the execution plan but the result in one of the cases > is unjus

Re: [GENERAL] resizing a varchar column on 8.3.8

2011-01-27 Thread Emi Lu
On 01/15/2011 04:22 PM, Jon Hoffman wrote: Hi, I found a post with some instructions for resizing without locking up the table, but would like to get some re-assurance that this is the best way: http://sniptools.com/databases/resize-a-column-in-a-postgresql-table-without-changing-data How does

Re: [GENERAL] Adding ddl audit trigger

2011-01-27 Thread Lawrence Cohan
If Postgres users are not allowed to add triggers to system catalogs (which is fair nothing to say) maybe they could be added into a future release of Postgres. Maybe some basic DDL auditing like the name/type of the object, action, userid(current_user), and timestamp be included in these audit

Re: [GENERAL] Queyring for columns which are exist in table.

2011-01-27 Thread Sim Zacks
What you will need to do in your function is ... sql = 'select ' || checkColumn('tbl','c2','0') || '::text as fld from tbl'; for row in execute sql loop return next row.fld; end loop; return; ... where the function returns a set of text (or int or whatever the datatype will always b

Re: [GENERAL] Select query ignores index on large table

2011-01-27 Thread hubert depesz lubaczewski
On Thu, Jan 27, 2011 at 04:04:02PM +0200, Michael Kemanetzis wrote: > Hello, I'm experiencing a strange behavior running a simple select query on > a table that has about 12 million rows. Specifically, changing the "LIMIT" > value seems to change the execution plan but the result in one of the case

[GENERAL] Select query ignores index on large table

2011-01-27 Thread Michael Kemanetzis
Hello, I'm experiencing a strange behavior running a simple select query on a table that has about 12 million rows. Specifically, changing the "LIMIT" value seems to change the execution plan but the result in one of the cases is unjustifiably slow, as if it ignores all indexes. The table structur

Re: [GENERAL] Queyring for columns which are exist in table.

2011-01-27 Thread Sim Zacks
On 01/27/2011 09:52 AM, Santosh Bhujbal (sabhujba) wrote: CREATE OR REPLACE FUNCTION ColumnAlreadyExists(name, name) RETURNS INTEGER AS E' DECLARE columnCount INTEGER; BEGIN SELECT COUNT (pg_attribute.attname) into columnCount FROM pg_attribute,pg_class, pg_type WHERE ((pg_attribute.attrel

Re: [GENERAL] Queyring for columns which are exist in table.

2011-01-27 Thread Thom Brown
On 27 January 2011 09:53, Santosh Bhujbal (sabhujba) wrote: > Hi Thom, > > Thank you for your response. > > I have a application which is periodically gathering diff stats from > diff devices and put them into database. > Tables are created per stat, per device and per day. > e.g. stat1_dev1_20100

Re: [GENERAL] Getting the name of the timezone, adjusted for daylight saving

2011-01-27 Thread Mark Morgan Lloyd
Tom Lane wrote: Steve Crawford writes: I think you may have confused yourself by the order of operations. This: ('2011-03-01 12:00' AT TIME ZONE 'GMT0BST')::TIMESTAMP WITH TIME ZONE created a timestamp from some text and you specified the time-zone to be used in creating that value (stored int

Re: [GENERAL] Queyring for columns which are exist in table.

2011-01-27 Thread Santosh Bhujbal (sabhujba)
Hi Thom, Thank you for your response. I have a application which is periodically gathering diff stats from diff devices and put them into database. Tables are created per stat, per device and per day. e.g. stat1_dev1_20100125, stat1_dev1_20100126, stat1_dev1_20100127, etc. stat1_dev2_2010012

Re: [GENERAL] Queyring for columns which are exist in table.

2011-01-27 Thread Thom Brown
On 27 January 2011 07:52, Santosh Bhujbal (sabhujba) wrote: > Hi All, > > > > I want to fire a query such that if the particular column does not exist > then query should return some default value. Why do you want to do this? What is it you using this for? -- Thom Brown Twitter: @darkixion IRC

[GENERAL] Queyring for columns which are exist in table.

2011-01-27 Thread Santosh Bhujbal (sabhujba)
Hi All, I want to fire a query such that if the particular column does not exist then query should return some default value. For that I have tried following experiment. SETUP details: Platform : Sun Solaris 5.10 Postgres : 8.3.7 CREATE TABLE tbl ( c1 integer,