Re: valid use of wildcard - Mailing list pgsql-general

From Scott Marlowe
Subject Re: valid use of wildcard
Date
Msg-id dcc563d10810291956pf6c0e7cpc8a8f50c53fd6ae7@mail.gmail.com
Whole thread Raw
In response to valid use of wildcard  (Irene Barg <ibarg@noao.edu>)
Responses Re: valid use of wildcard  (Klint Gore <kgore4@une.edu.au>)
List pgsql-general
On Wed, Oct 29, 2008 at 5:04 PM, Irene Barg <ibarg@noao.edu> wrote:
> Hi,
>
> Is the following query a valid use of the 'wildcard' in (='2008-10-27%')?
>
>> [arcsoft@dsan4 arcsoft]$ psql metadata
>> Password: Welcome to psql 8.1.9, the PostgreSQL interactive terminal.
>>
>> metadata=# SELECT * FROM viewspace.siap AS t WHERE
>> t."startDate"='2008-10-27%' AND t.prop_id LIKE '%' LIMIT 1000;
>
> Causes the %CPU to jump and process lingers for over an hour.

Bad move.  dates aren't strings, and their format can change based on
what you've got set for datestyle.

If you want a start date (that's a date or a timestamp) then use the
proper operators

where startDate='2008-10-27'

If startDate is a text / varchar type then you need to change it to a
date.  storing dates in strings is bad.

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Can't restart Postgres
Next
From: Eus
Date:
Subject: Why Postgresql Public Schema Is Not Owned By The DB Owner By Default