pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Is there anyway to create a functional index using to_date?
3+ messages / 3 participants
[nested] [flat]

* Is there anyway to create a functional index using to_date?
@ 2005-08-16 20:24 Chris Hoover <revoohc@gmail.com>
  2005-08-16 21:07 ` Re: Is there anyway to create a functional index using to_date? Bruno Wolff III <bruno@wolff.to>
  0 siblings, 1 reply; 3+ messages in thread

From: Chris Hoover @ 2005-08-16 20:24 UTC (permalink / raw)
  To: pgsql-admin

I'm running 7.3.4 and we are having problems with our reporting views
on our database.  One fix I wanted to do was to create a functional
index using the to_date function.  However, when I do a create index
abc on table def(to_date(char_field,'yyyymmdd')), PostgreSQL complains
about a parser error at the 'yyyymmdd'.  Is there anyway to force
PostgreSQL to create this kind of index?

I can get it to create on if I create a special function that just
takes the field to be converted and returns the converted date. 
However, I would prefer not to go that route since it requires us to
update all of our views.

Thanks for any help,

Chris



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Is there anyway to create a functional index using to_date?
  2005-08-16 20:24 Is there anyway to create a functional index using to_date? Chris Hoover <revoohc@gmail.com>
@ 2005-08-16 21:07 ` Bruno Wolff III <bruno@wolff.to>
  2005-08-17 03:02   ` Re: Is there anyway to create a functional index using to_date? Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Bruno Wolff III @ 2005-08-16 21:07 UTC (permalink / raw)
  To: Chris Hoover <revoohc@gmail.com>; +Cc: pgsql-admin

On Tue, Aug 16, 2005 at 16:24:37 -0400,
  Chris Hoover <revoohc@gmail.com> wrote:
> I'm running 7.3.4 and we are having problems with our reporting views
> on our database.  One fix I wanted to do was to create a functional
> index using the to_date function.  However, when I do a create index
> abc on table def(to_date(char_field,'yyyymmdd')), PostgreSQL complains
> about a parser error at the 'yyyymmdd'.  Is there anyway to force
> PostgreSQL to create this kind of index?
> 
> I can get it to create on if I create a special function that just
> takes the field to be converted and returns the converted date. 
> However, I would prefer not to go that route since it requires us to
> update all of our views.

That is what you have to do in older versions of postgres. You don't have
to do that in 8.0 (I am not sure about 7.4).



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Is there anyway to create a functional index using to_date?
  2005-08-16 20:24 Is there anyway to create a functional index using to_date? Chris Hoover <revoohc@gmail.com>
  2005-08-16 21:07 ` Re: Is there anyway to create a functional index using to_date? Bruno Wolff III <bruno@wolff.to>
@ 2005-08-17 03:02   ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2005-08-17 03:02 UTC (permalink / raw)
  To: Bruno Wolff III <bruno@wolff.to>; +Cc: Chris Hoover <revoohc@gmail.com>; pgsql-admin

Bruno Wolff III <bruno@wolff.to> writes:
> Chris Hoover <revoohc@gmail.com> wrote:
>> I can get it to create on if I create a special function that just
>> takes the field to be converted and returns the converted date. 

> That is what you have to do in older versions of postgres. You don't have
> to do that in 8.0 (I am not sure about 7.4).

7.4 does it too.  7.3 is ... um ... old.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2005-08-17 03:02 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-08-16 20:24 Is there anyway to create a functional index using to_date? Chris Hoover <revoohc@gmail.com>
2005-08-16 21:07 ` Bruno Wolff III <bruno@wolff.to>
2005-08-17 03:02   ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox