On Jul 1, 2008, at 10:39 AM, Martin Bowes wrote:
>
> I'm trying to set up a table with a sub-partitioned on month of
> year, but the date functions don't appear to be allowed within the
> syntax…
>
That's right, and there isn't any quick way to allow it that I can
think of, either.
The partitioning catalogs and data structures really expect to be
operating
on constants. Extending them to functions will be a head-scratcher.
At the moment, all I can think of is to either range partition by
month and
break it all out explicitly, or add a "captured_month" column to the
table
(possibly updated by the old rule trick if your data source doesn't
want to
hear about it) and use that for the list partitioning.
By the way, since one can reasonably expect months to be in the range
1..12,
you can save yourself an empty partition by defining the last one as
values (12,DEFAULT). That satisfies the rules without leaving empty
partitions lying around.
Karl
> modify eyeballz to btree on captured_date
>
> with partition=((
>
> range on captured_date
>
> partition eyeballz_pre_2008 values < '1/1/2008',
>
> partition eyeballz_2008 values < '1/1/2009',
>
> partition eyeballz_post_2008 values >= '1/1/2009')
>
> subpartition (list on date_part('month', captured_date)
>
> partition eyeballz_sp_jan values (1),
>
> ...
>


|