Re: [SQL] Text->Date conversion in a WHERE clause

2005-10-12 Thread Tom Lane
[EMAIL PROTECTED] writes: > SELECT * > FROM > ( > SELECT u.user_id, ud.data > FROM users u, userdata ud > WHERE u.user_id = ud.user_id > AND u.type = 1 > ) subusers > WHERE subusers.data::text::date < now(); > So my question is how does this query ever even SEE the row con

Re: [SQL] Text->Date conversion in a WHERE clause

2005-10-12 Thread Tom Lane
Collin Peters <[EMAIL PROTECTED]> writes: > WHERE cust3 <> '' > AND cust3::text::timestamp > CURRENT_DATE - interval '1 month' > This results in the error 'ERROR: date/time field value out of range: > "052-44-5863"'. Now that is obviously not a valid date but there > is actually more to the

Re: [SQL] Text->Date conversion in a WHERE clause

2005-10-12 Thread Greg Stark
Collin Peters <[EMAIL PROTECTED]> writes: > I have a table that has some columns which store 'custom' fields so the > content varies according to the user that the row belongs to. For one > of the groups of users the field is a date (the type of the field is > 'text' though). I'm trying to perfo

Re: [SQL] Text->Date conversion in a WHERE clause

2005-10-12 Thread cadiolis
As an example: CREATE TABLE userdata ( userdata_id serial NOT NULL, user_id smallint, data text ); CREATE TABLE users ( user_id serial NOT NULL, name text, "type" smallint ); INSERT INTO userdata (userdata_id, user_id, data) VALUES (1, 1, '2005-01-01'); INSERT INTO userda

[SQL] Text->Date conversion in a WHERE clause

2005-10-12 Thread Collin Peters
I have a table that has some columns which store 'custom' fields so the content varies according to the user that the row belongs to. For one of the groups of users the field is a date (the type of the field is 'text' though). I'm trying to perform a query where it only returns values in a certai