Creating index for convert text to integer - Mailing list pgsql-general

From xaviergxf
Subject Creating index for convert text to integer
Date
Msg-id f4d3874a-50b6-49a8-b943-609aec7a37ad@r42g2000yqj.googlegroups.com
Whole thread Raw
Responses Re: Creating index for convert text to integer  (Sam Mason <sam@samason.me.uk>)
List 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!



pgsql-general by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: PG 8.2 instal on Win2k3 - unable to connect to test network socket
Next
From: Sam Mason
Date:
Subject: Re: No download of Windows binaries without registering?