Thanks for clarification!
As you already noted the first case can make use of the date_part function:
-
SELECT field-list FROM tabname WHERE date_part('month', column-name) BETWEEN 10 and 12;
-
As far as your second case, with the
date datatype you should not have any values like '2006-1-5'.
Even if this is what you use with INSERT, the actual value on the table should be '2006-01-05', so the date_part function should have no troubles parsing this value.
You can also try to modify the example you posted above:
-
table.datefield >= '2005-10-*' AND table.datefield <= '2006-2-*'
-
-- change it to
-
table.datefield >= '2005-10-01' AND table.datefield <= '2006-02-28'
-
(BETWEEN may come handy here too)
One catch here is that every month begins with 01, but not all of them have the same end-date (think of 28, 29, 30, 31),
and if you give a non-existant end-date the query may error out, so this approach may require little extra thought.
There could be more tricks to employ here, but first let us know whether this info was helpful.