Re: [GENERAL] Pet Peeves

2009-01-31 Thread Adam Rich
On Thu, 29 Jan 2009 13:16:17 + Gregory Stark wrote: > So, what do people say? Is Postgres perfect in your world or does it > do some things which rub you the wrong way? I see all the major ones have already been mentioned, so here's some minor ones. - lack of system-level and DDL triggers

Re: [GENERAL] ALTER TABLE with TYPE serial does not work

2009-01-31 Thread Richard Broersma
On Sat, Jan 31, 2009 at 3:16 PM, Andreas Wenk wrote: > Why does this not work: > > postgres=# ALTER TABLE tab1 ALTER COLUMN nr TYPE serial; > ERROR: type "serial" does not exist serial is really just "short-hand" for making an integer column use default incrementing function. The following wil

Re: [GENERAL] Pet Peeves?

2009-01-31 Thread Reece Hart
My two: * lack of PK/unique indexes on inherited tables (workarounds possible but annoying) * lack of auto-tuning or tuning tools (or perhaps my lack of awareness of them?) -Reece -- Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0

Re: [GENERAL] ALTER TABLE with TYPE serial does not work

2009-01-31 Thread Jasen Betts
On 2009-01-31, Andreas Wenk wrote: > Hi List, > > I have a short question to psql. > > Why does this not work: > > postgres=# ALTER TABLE tab1 ALTER COLUMN nr TYPE serial; > ERROR: type "serial" does not exist > > but this: > > postgres=# ALTER TABLE tab1 DROP COLUMN nr; > ALTER TABLE > postgres=

Re: [GENERAL] Rollback of Query Cancellation

2009-01-31 Thread Jasen Betts
On 2009-01-28, Abdul Rahman wrote: > --0-2110834523-1233119974=:72728 > Content-Type: text/plain; charset=us-ascii > > Dear All, > > Yesterday I canceled a running query because it was taking long time > (more than 12 minutes) to delete lots of records. Today when I > executed the same query it ha

[GENERAL] Re: how to implement a foreign key type constraint against a not unique column

2009-01-31 Thread Jasen Betts
On 2009-01-27, Alban Hertroys wrote: > On Jan 25, 2009, at 3:07 AM, Jasen Betts wrote: > >>> I want to use this column as a foreign key on a column in another >>> table >>> (column 2), but cannot without a full unique index. >> >> a full unique index is easy use an expression that's null for -1.

Re: [GENERAL] Indices types, what to use. Btree, Hash, Gin or Gist

2009-01-31 Thread Scott Marlowe
On Sat, Jan 31, 2009 at 1:33 PM, Gregory Stark wrote: > No index is going to be particularly effective for boolean columns unless > they're very heavily skewed. You might find it useful to build separate > partial indexes on other keys for each value though. Not entirely true. If you've got a ta

Re: [GENERAL] Indices types, what to use. Btree, Hash, Gin or Gist

2009-01-31 Thread Kevin Murphy
Gregory Stark wrote: Mohamed writes: I want to match against a boolean field, that is, only true or false is possible. I am thinking Btree but not sure.. correct? No index is going to be particularly effective for boolean columns unless they're very heavily skewed. You might find it

Re: [GENERAL] Pet Peeves?

2009-01-31 Thread Octavio Alvarez
On Sat, 2009-01-31 at 23:36 +, Gregory Stark wrote: > Octavio Alvarez writes: > > > A crosstab is not but a presentational transform of the data set. Any > > information you would eventually need can be taken from the original > > data source, one way or another. That's why dynamic-column cro

Re: [GENERAL] Pet Peeves?

2009-01-31 Thread Gregory Stark
Octavio Alvarez writes: > In any case, the results are the same as GROUPing BY from the data > source. > +-+-+ > | Assignment | Average | > +-+-+ > | Assignment1 | 94.67 | > | Assignment2 | 90.33 | > | Assignment3 | 86.67 | > +-+-

[GENERAL] ALTER TABLE with TYPE serial does not work

2009-01-31 Thread Andreas Wenk
Hi List, I have a short question to psql. Why does this not work: postgres=# ALTER TABLE tab1 ALTER COLUMN nr TYPE serial; ERROR: type "serial" does not exist but this: postgres=# ALTER TABLE tab1 DROP COLUMN nr; ALTER TABLE postgres=# ALTER TABLE tab1 ADD COLUMN nr serial; NOTICE: ALTER TA

Re: [GENERAL] Pet Peeves?

2009-01-31 Thread Octavio Alvarez
On Sat, 2009-01-31 at 18:32 +, Greg Stark wrote: > On Sat, Jan 31, 2009 at 5:34 PM, Octavio Alvarez > wrote: > > > > It doesn't really matter. Since crosstabs are just a presentational > > variation to a query with aggregate functions and GROUP BY clauses, > > > Why are crosstabs just a pres

Re: [GENERAL] Indices types, what to use. Btree, Hash, Gin or Gist

2009-01-31 Thread Gregory Stark
Mohamed writes: > Hi, > I have several fields that use to match with my queries. I am curious to > what index types is best for what. Here is some examples that will help you > understand. > > Say I have a 1000 000 rows. > > Speed is of the essence here, insertions and updates happens relatively

Re: [GENERAL] Pet Peeves?

2009-01-31 Thread Scott Marlowe
On Sat, Jan 31, 2009 at 11:10 AM, rhubbell wrote: > Thanks, using the same apt commands, try to find pg_config. > (^; It's easy: /home/smarlowe$ pg_config The program 'pg_config' is currently not installed. You can install it by typing: sudo apt-get install libpq-dev bash: pg_config: command no

Re: [GENERAL] Pet Peeves?

2009-01-31 Thread Jasen Betts
On 2009-01-30, Steve Crawford wrote: > >> You can however pull it from a -Fc backup with pg_restore. Just FYI. >> >> Joshua D. Drake >> > > Or strip it from a pg_dump/pg_dumpall with sed. Or write your own > function-dumper based on ideas gleaned from various notes/comments on > the web (my a

[GENERAL] Indices types, what to use. Btree, Hash, Gin or Gist

2009-01-31 Thread Mohamed
Hi, I have several fields that use to match with my queries. I am curious to what index types is best for what. Here is some examples that will help you understand. Say I have a 1000 000 rows. Speed is of the essence here, insertions and updates happens relatively less frequent than search. I wa

Re: [GENERAL] Pet Peeves?

2009-01-31 Thread Jasen Betts
On 2009-01-29, Steve Crawford wrote: > >>> 3. Date handling >>> Sometimes I've got data with invalid dates and it would be great if it >>> could replace all the bad ones with, say "-00-00". >>> -00-00 doesn't fit in a date column. perhaps you could use null? write a function tha

Re: [GENERAL] getting no days problem

2009-01-31 Thread Jasen Betts
On 2009-01-29, sanjeev kumar wrote: > --000e0cd150b60728d804619c963d > Content-Type: text/plain; charset=ISO-8859-1 > Content-Transfer-Encoding: 7bit > > Hi all, > > I have written procedure as follows: > - > --procedure begin > Create Proced

Re: [GENERAL] Pet Peeves?

2009-01-31 Thread Greg Stark
On Sat, Jan 31, 2009 at 5:34 PM, Octavio Alvarez wrote: > > It doesn't really matter. Since crosstabs are just a presentational > variation to a query with aggregate functions and GROUP BY clauses, Why are crosstabs just a presentation issue any more than GROUP BY or ORDER BY? -- greg -- Sen

Re: [GENERAL] Pet Peeves?

2009-01-31 Thread Greg Stark
On Sat, Jan 31, 2009 at 6:10 PM, rhubbell wrote: > Thanks, using the same apt commands, try to find pg_config $ apt-file search bin/pg_config libpq-dev: /usr/bin/pg_config postgresql-server-dev-8.3: /usr/lib/postgresql/8.3/bin/pg_config That is confusing actually. However, the readme for DBD::P

Re: [GENERAL] Pet Peeves?

2009-01-31 Thread Roger Leigh
On Sat, Jan 31, 2009 at 10:10:01AM -0800, rhubbell wrote: > Thanks, using the same apt commands, try to find pg_config. Well, those commands search package names and metadata (including descriptions), and pg_config isn't mentioned so you won't find anything. Given that pg_config matches the versi

Re: [GENERAL] Pet Peeves?

2009-01-31 Thread rhubbell
Thanks, using the same apt commands, try to find pg_config. (^; On Sat, 31 Jan 2009 12:38:18 + Roger Leigh wrote: > On Fri, Jan 30, 2009 at 03:44:48PM -0800, rhubbell wrote: > > On Fri, 30 Jan 2009 20:38:06 + > > Gregory Stark wrote: > > > > > > > > rhubbell writes: > > > > > > >

Re: [GENERAL] PGSQL or other DB?

2009-01-31 Thread Scott Marlowe
On Sat, Jan 31, 2009 at 2:13 AM, Erik Jones wrote: > > On Jan 30, 2009, at 11:37 AM, durumdara wrote: >> - I can add/modify a table, or a field to a table without "full lock" on >> the table (like DBISAM restructure). Like in FireBird, where the "add field" >> change only the table description.

Re: [GENERAL] Pet Peeves?

2009-01-31 Thread Octavio Alvarez
On Fri, 2009-01-30 at 14:25 +, Gregory Stark wrote: > "Daniel Verite" writes: > > > Gregory Stark wrote: > > > >> Is it the hierarchical query ability you're looking for or pivot? > >> The former we are actually getting in 8.4. > >> > >> AFAIK even in systems with pivot you still have to

Re: [GENERAL] Pet Peeves?

2009-01-31 Thread Holger Hoffstaette
On Sat, 31 Jan 2009 15:28:31 +0100, Martijn van Oosterhout wrote: > Nicest would be ofcourse a niceness level, so that VACUUM slows itself > down according to the amount of queries going on (to a minimum ofcourse). Linux has IO priority support for this, see ionice. Starting with 2.6.28 the CFQ s

Re: [GENERAL] Pet Peeves?

2009-01-31 Thread Shane Ambler
Gregory Stark wrote: MS-Access SQL has a TRANSFORM clause that allows for crosstab queries without the need to know in advance the number of columns: http://msdn.microsoft.com/en-us/library/bb208956.aspx That's puzzling. I wonder what they do about clients requesting info about the results. Or

Re: [GENERAL] Pet Peeves?

2009-01-31 Thread Martijn van Oosterhout
On Fri, Jan 30, 2009 at 02:43:13PM -0800, Ron Mayer wrote: > I guess I'd still like some more convenient tuning of autovacuum (perhaps > specifying X mbps disk I/O); but I'd say vacuum fell off my pet-peeve list > around the 8.1 timeframe. ah yes, that reminds me. If I know what my disk subsystem

[GENERAL] Returning old value on update

2009-01-31 Thread Gerhard Heift
Hello, is it possible to get the old value of an update, something like this: INSERT INTO my_table (col) VALUES (2); UPDATE my_table SET col = 4 RETURNING old.col; Should give me the 2. Regards, Gerhard signature.asc Description: Digital signature

Re: [GENERAL] Pet Peeves?

2009-01-31 Thread Roger Leigh
On Fri, Jan 30, 2009 at 03:44:48PM -0800, rhubbell wrote: > On Fri, 30 Jan 2009 20:38:06 + > Gregory Stark wrote: > > > > > rhubbell writes: > > > > > Nope, had to find it in another package called libpq-dev. > > > That's on UbuntuHardy. Maybe it's a maintainer problem? > > > > > > What lo

Re: [GENERAL] database/table snapshot

2009-01-31 Thread Jasen Betts
On 2009-01-30, Grzegorz Jaƛkiewicz wrote: > Hey folks, > > I wonder, how would you guys approach table snapshots. > So the thing is, I have table X (I have few more tables, but lets > simplify that). That table is being replicated to X' on other server. > Now I need an ability to see changes, say

Re: [GENERAL] Call volume query

2009-01-31 Thread Jasen Betts
On 2009-01-29, Mike Diehl wrote: > Hi all. > > I've encountered an SQL problem that I think is beyond my skills... > > I've got a table full of records relating to events (phone calls, in > this case) and I need to find the largest number of events (calls) > occurring at the same time. one time w

Re: [GENERAL] Pet Peeves?

2009-01-31 Thread Gregory Stark
rhubbell writes: >> Installing a package for DBD::Pg or building it? The former would indeed be a >> package bug. > > When I installed the package I did via CPAN so maybe this was my mistake. > Not every CPAN package is packaged for debian so I often times don't bother > checking if a perl module

Re: [GENERAL] PGSQL or other DB?

2009-01-31 Thread Erik Jones
On Jan 30, 2009, at 11:37 AM, durumdara wrote: The main viewpoints: - quick (re)connect - because mod_python basically not store the database connections persistently mod_python is not a database adaptor. Put another way, mod_python does not make database connections. If you're using P