Re: [SQL] Prevent double entries ... no simple unique index

2012-07-12 Thread Andreas
Am 12.07.2012 07:14, schrieb Andreas Kretschmer: Marc Mamin wrote: A partial index would do the same, but requires less space: create unique index on log(state) WHERE state IN (0,1); OK, nice :) What if I have those states in a 3rd table? So I can see a state-history of when a state g

Re: [SQL] Prevent double entries ... no simple unique index

2012-07-12 Thread David Johnston
On Jul 12, 2012, at 4:44, Andreas wrote: > Am 12.07.2012 07:14, schrieb Andreas Kretschmer: >> Marc Mamin wrote: >> >>> A partial index would do the same, but requires less space: >>> >>> create unique index on log(state) WHERE state IN (0,1); >> > > > OK, nice :) > > What if I have thos

[SQL] How does Numeric division determine precision?

2012-07-12 Thread Will Pugh
Hi, I'm using Postgres 9.1, and wanted to understand how some of the numeric operations work. It seems that is 9.1, numerics that don't have a specified precision and scale are arbitrary scale/precision. For many operations this is straightforward. However, when doing a division operation that

Re: [SQL] How does Numeric division determine precision?

2012-07-12 Thread Tom Lane
Will Pugh writes: > It seems that is 9.1, numerics that don't have a specified precision > and scale are arbitrary scale/precision. > For many operations this is straightforward. However, when doing a > division operation that does not terminate, I'm curious about how the > number of digits is de