Re: Problem with a Pettern Matching Check
От | Dmitri Bichko |
---|---|
Тема | Re: Problem with a Pettern Matching Check |
Дата | |
Msg-id | F18A6F7CF1661F46920F2CF713122FED46CC63@mail.aveo.aveopharma.com обсуждение исходный текст |
Ответ на | Problem with a Pettern Matching Check (Sebastian Siewior <lavish@kamp-dsl.de>) |
Ответы |
Re: Problem with a Pettern Matching Check
|
Список | pgsql-sql |
I'm guessing it's because char gets padded with spaces to the specified length. Any reason you are using char(3) instead of varchar(3)? And why are you storing numbers as a string, anyway? If you defined the column as a numeric type, postgres will tell you if you try to insert something non-numeric. Dmitri -----Original Message----- From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Sebastian Siewior Sent: Monday, August 15, 2005 6:20 PM To: pgsql-sql@postgresql.org Subject: [SQL] Problem with a Pettern Matching Check Hello hopefully correct List, I was trying to do something that is not working as it supposed to. First I created a table: create table t ( col CHAR (3) CONSTRAINT numonly_col CHECK ( col ~ '^\\d+$' ) ); This check avoids non-numbers like '1a1' and allows '123'. For some reason, I'm unable to find out why, it also avoids things like '1' and '12'. Could someone please give me hint? :) I was trying this one on PostgreSQL 8.0.3 -- Regards Sebastian Siewior ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypesdo not match The information transmitted is intended only for the person or entity to which it is addressed and may contain confidentialand/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any actionin reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you receivedthis in error, please contact the sender and delete the material from any computer
В списке pgsql-sql по дате отправления: