-- read data from index.txt -- the fields are
drop table realdb;
create table realdb (
mls         char8,
xmls        char8,
price	    int,
statecode   char2,
state       text,
county	    text,
city        text,
rooms       int2,
beds        int2,
baths       int2,
agent       text,
aphone      char16,
xdate       date,
upd	    char
blurb	    text,
);

-- copy realdb'/home/postgres/realtor/all.db' using delimiters '^';

create index realdb_xmls_bt on realdb using btree (xmls char8_ops);
create index realdb_state_bt on realdb using btree (state text_ops);
create index realdb_county_bt on realdb using btree (county text_ops);
create index realdb_city_bt on realdb using btree (city text_ops);
create index realdb_price_bt on realdb using btree (price int4_ops);
create index realdb_rooms_bt on realdb using btree (rooms int2_ops);
create index realdb_beds_bt on realdb using btree (beds int2_ops);
create index realdb_baths_bt on realdb using btree (baths int2_ops);

grant SELECT,INSERT,DELETE,UPDATE on realdb to public;


