[GENERAL] Planner not using UNIQUEness of index properly

2007-12-10 Thread John Burger
I have a unique function index on one of my tables: create table allWords ( wordIDserial PRIMARY KEY, word textNOT NULL ); create unique index ix_allWords_lower on allWords (lower(word)); To my surprise, the planner does not seem to realize that only one row can

Re: [GENERAL] Planner not using UNIQUEness of index properly

2007-12-10 Thread John Burger
Tom Lane wrote: I would think UNIQUE = one row is pretty obvious - what am I missing? (Unless it's that I'm still stuck in 7.4.) That would be the problem :-( ... a look at the code suggests that the ability to do anything intelligent with expression indexes was added in 8.0. Whaa. Okay,

Re: [GENERAL] Will PG use composite index to enforce foreign keys?

2007-12-03 Thread John Burger
Scott Marlowe wrote: As a secondary question, is there any way I could have answered this myself, using analyze, the system catalogs, etc? ANALYZE DELETE doesn't seem to show the FK checking that must go on behind the scenes. You could have coded up an example to see if it worked I guess.

[GENERAL] Will PG use composite index to enforce foreign keys?

2007-11-29 Thread John Burger
Hi - I know that the foreign key machinery will use an index on the referring column if one exists. My question is whether it will use a composite index? For instance: create table allLemmaSenseMap ( wordID integer references allLemmas, senseIDinteger references allSenses,

Re: [GENERAL] plpgsql constraint checked data fails to restore

2005-06-20 Thread John Burger
I don't have personal experience with this, but I thought it was fairly common to DEFER constraint checking until after a restore completed, for exactly this reason. - John Burger MITRE ---(end of broadcast)--- TIP 9: the planner will ignore

Re: [GENERAL] numeric precision when raising one numeric to another.

2005-05-18 Thread John Burger
, on the Mac I'm using now, long long ints max out at about 10^19, while long doubles can represent 10^308. - John Burger MITRE ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [GENERAL] Duplicate records in table

2005-04-10 Thread John Burger
. You could get what you want by using another NULL-like value, e.g., an empty string ''. You might be able to use a trigger, too. - I have little experience with those. - John Burger MITRE ---(end of broadcast)--- TIP 3: if posting/reading

Re: [GENERAL] Crazy Multiplication Issue

2005-04-04 Thread John Burger
Howdy Gents- Howdy to everyone else. I am multiplying two columns it doesn't matter what their data type is not does it seem to matter if I explicitly cast these values to some other data type every time they are multiplied I am getting an incorrect result. col1 = 213.1086 col2 = 0.833 If I

[GENERAL] Insert without duplicates

2005-04-01 Thread John Burger
Hi - This has been covered elsewhere, but the typical answers seem to involve using triggers, etc. What's the best way to insert a row into a table providing it's not already there? In my client (Python) program, I can do two separate interactions with the server, the first a query: select

Re: [GENERAL] do I need replication or something else?

2005-03-29 Thread John Burger
If it were me, and someone proposed a model where two-way replication was needed, I would tell them to rethink their model. It's broken. I would respectfully disagree that the requirement for two-way replication indicates a broken design. I agree with your disagreement. This design is present