Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-17 Thread Rob Sargent
Alexander Farber wrote: Hello, really good advices here! But - On Sun, Oct 17, 2010 at 2:37 AM, Rob Sargent wrote: I just read the "anonymously" part, so I take it you have ruled out recording the given coordinate components directly, in multiple columns presumably? Otherwise it seems yo

Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-17 Thread Tom Lane
Alexander Farber writes: > how do you select the "x" and "y" parts of a point data type? pointval[0] and pointval[1] --- this is mentioned somewhere in the fine print in the "geometric functions and operators" page, IIRC. regards, tom lane -- Sent via pgsql-general mail

Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-17 Thread Alexander Farber
Hello again, I have 1 more question please: how do you select the "x" and "y" parts of a point data type? Can't find it in http://www.postgresql.org/docs/8.4/interactive/functions-geometry.html For example, I have this table with a "pos" column: snake=> \d gps Table "public.g

Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-17 Thread Harald Fuchs
In article <4cba2bc4.9030...@darrenduncan.net>, Darren Duncan writes: > I would further recommend turning the above into a separate data type, > especially if you'd otherwise be using that constraint in several > places, like this ... FWIW, the shatypes contrib package includes a binary md5 data

Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-16 Thread Alexander Farber
Hello, really good advices here! But - On Sun, Oct 17, 2010 at 2:37 AM, Rob Sargent wrote: > I just read the "anonymously" part, so I take it you have ruled out > recording the given coordinate components directly, in multiple columns > presumably?  Otherwise it seems you could then do a) a compo

Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-16 Thread Rob Sargent
I just read the "anonymously" part, so I take it you have ruled out recording the given coordinate components directly, in multiple columns presumably? Otherwise it seems you could then do a) a composite key and b) queries directly against coordinate values. Alexander Farber wrote: Thank y

Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-16 Thread Darren Duncan
Alexander Farber wrote: I'm trying to create a table, where md5 strings will serve as primary keys. So I'd like to add a constraing that the key length should be 32 chars long (and contain [a-fA-F0-9] only): create table gps ( id varchar(32) primary key CONSTRAINT char_length(id)==32, stamp time

Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-16 Thread Alexander Farber
Thank you for your advices. I actually would like to store GPS coordinates, but anonymously, so I was going to save md5(my_secret+IMEI) coming from a mobile... I have to lookup if uuid is supported there Regards Alex On Sat, Oct 16, 2010 at 11:08 PM, Rob Sargent wrote: > Merlin Moncure wrote:

Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-16 Thread Rob Sargent
Merlin Moncure wrote: On Sat, Oct 16, 2010 at 12:15 PM, Alexander Farber wrote: Hello, I'm trying to create a table, where md5 strings will serve as primary keys. So I'd like to add a constraing that the key length should be 32 chars long (and contain [a-fA-F0-9] only): why don't y

Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-16 Thread Merlin Moncure
On Sat, Oct 16, 2010 at 12:15 PM, Alexander Farber wrote: > Hello, > > I'm trying to create a table, where md5 strings will serve as primary keys. > So I'd like to add a constraing that the key length should be 32 chars long > (and contain [a-fA-F0-9] only): why don't you use the bytea type, and

Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-16 Thread Guy Rouillier
On 10/16/2010 12:48 PM, Alexander Farber wrote: snake=> create table gps ( id varchar(32) primary key CONSTRAINT id_length char_length(id)=32, stamp timestamp DEFAULT current_timestamp, pos point); ERROR: syntax error at or near "char_length" LINE 2: id varchar(32) primary key CONSTRAINT id_len

Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-16 Thread Raymond O'Donnell
On 16/10/2010 17:48, Alexander Farber wrote: snake=> create table gps ( id varchar(32) primary key CONSTRAINT id_length char_length(id)=32, stamp timestamp DEFAULT current_timestamp, pos point); ERROR: syntax error at or near "char_length" LINE 2: id varchar(32) primary key CONSTRAINT id_length

Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-16 Thread Alexander Farber
snake=> create table gps ( id varchar(32) primary key CONSTRAINT id_length char_length(id)=32, stamp timestamp DEFAULT current_timestamp, pos point); ERROR: syntax error at or near "char_length" LINE 2: id varchar(32) primary key CONSTRAINT id_length char_length(...

Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-16 Thread Raymond O'Donnell
On 16/10/2010 17:15, Alexander Farber wrote: Hello, I'm trying to create a table, where md5 strings will serve as primary keys. So I'd like to add a constraing that the key length should be 32 chars long (and contain [a-fA-F0-9] only): create table gps ( id varchar(32) primary key CONSTRAINT ch