On Fri, Apr 17, 2015 at 8:45 AM, Melvin Davidson <melvin6...@gmail.com>
wrote:

> ​
> On Fri, Apr 17, 2015 at 11:34 AM, Kynn Jones <kyn...@gmail.com> wrote:
>
>>
>> One consideration that is complication the choice of primary key
>> is wanting to have the ability to store chunks of the data
>> table (not the metadata table), including the PK column, as
>> matrices of doubles.  In its simplest form, this would mean using
>> doubles as primary keys, but this seems to me a bit weird.
>>
>> I'm willing to go ahead with this, but I wanted to ask for your
>> feedback on the whole thing.  In particular I'd like to know if
>> there are there standard ways for using doubles as primary keys,
>> and, conversely, if there are known pitfalls I should be looking
>> out for, but I welcome any other words of wisdom you may have on
>> this topic.
>>
>
MD>> ​
​
First, please ALWAYS include the version and O/S, even with basic questions.

​
MD>>
​
I'm not sure what you mean by doubles. Do you mean bigint data type, or do
you mean use two columns for a primary key? Either way it's pretty simple.
​
MD>>
​
If you mean a bigint, then probably best to use serial data type, which
will default to the next value.
​
MD>>
​
If you mean use two columns for a Primary Key, the you just specify the
columns.
​
MD>>
​
EG: CONSTRAINT PRIMARY KEY table_name_pk PRIMARY KEY (col1, col2)

​I take it the OP means "double precision" ​

http://www.postgresql.org/docs/9.0/static/datatype-numeric.html

I'd be suspect of choosing a PK whose type definition includes the word
"inexact".

You also say you want to store the data as a double precision but you never
actually explain what the natural key of the data is.

If you are strictly storing serial (big) integers but doing so within a
double precision typed column you may be OK - but I would advise taking
input from someone with more expertise on the properties of IEEE floating
point numbers.

David J.

Reply via email to