GnuCash Daily Source Diff

Linas Vepstas linas@linas.org
Wed, 7 Nov 2001 17:20:58 -0600


On Wed, Nov 07, 2001 at 01:51:44PM -0800, Dave Peticolas was heard to remark:
> 
> That is actually a bug fix. If a query happened to contain
> both a split amount predicate and a split value predicate,
> you would get something like:
> 
> ... AND gncCommodity.commodity=gncTransaction.currency ...
> ... AND gncCommodity.commodity=gncAccount.commodity ...
> 
> Thus, the query would succeed only if the transaction had
> the same commodity as the account, since the gncCommodity
> reference had to refer to the same row. To disambiguate
> them, you need a 'self-join' where you refer to two or
> more separate instances of the same table, like this:
> 
> ... AND account_com.commodity=gncTransaction.currency ...
> ... AND trans_com.commodity=gncAccount.commodity ...

Ahh, yes, indeed.  Good catch.

> > Where did you learn this???
> 
> I learned it from the book "Postgresql: Introduction and Concepts"
> by Bruce Momjian, who is one of the main Postgres people. Pretty
> good book, I thought.

Does the book say anything about performance when using a 'primary 
key' that is not an int?  (such as a 32-character ascii string ???)

--linas


-- 
pub  1024D/01045933 2001-02-01 Linas Vepstas (Labas!) <linas@linas.org>
PGP Key fingerprint = 8305 2521 6000 0B5E 8984  3F54 64A9 9A82 0104 5933