| From: | xaviergxf <xaviergxf(at)gmail(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Creating index for convert text to integer |
| Date: | 2009-08-26 14:13:41 |
| Message-ID: | f4d3874a-50b6-49a8-b943-609aec7a37ad@r42g2000yqj.googlegroups.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hi,
How can i create a index to index all the fields that has the type
INTEGER, in the following table:
create type properties_types as enum('INTEGER', 'STRING', 'FLOAT');
create table properties_types(
value text NOT NULL,
value_type properties_types NOT NULL
);
insert into properties_types values('1', 'INTEGER');
insert into properties_types values('2', 'INTEGER');
insert into properties_types values('3', 'INTEGER');
insert into properties_types values('4', 'INTEGER');
how do i create index for the integer types?
create index properties_types_index on properties_types
((value ::integer)) where value_type='INTEGER'
Can i use this select with the index?
select valor from properties_types where value::integer<3
Thanks!
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Gerhard Heift | 2009-08-26 14:26:13 | Re: How to create a multi-column index with 2 dates using 'gist'? |
| Previous Message | Matthew Wakeling | 2009-08-26 14:07:45 | Re: Fwd: How to create a multi-column index with 2 dates using 'gist'? |