title: ERROR: invalid input syntax for integer: "1.5"?
body: <p>I'm trying to execute the following code to see if I related the tables of my model correctly:</p>
  
  <pre><code>drop table if exists ImportA;
  create table ImportA (
  
      id varchar(255),
      url varchar(255),
      name varchar(255),
      description text,
      picture_url varchar(255),
      street varchar(255),
      neighbourhood varchar(255),
      city varchar(255),
      state varchar(255),
      zipcode varchar(255),
      country_code varchar(255),
      country varchar(255),
      property_type varchar(255),
      accommodates varchar(255),
      bathrooms varchar(255),
      bedrooms varchar(255),
      beds varchar(255),
      amenities text,
      square_feet varchar(255),
      price varchar(255),
      weekly_price varchar(255),
      monthly_price varchar(255),
      security_deposit varchar(255),
      cleaning_fee varchar(255),
      minimum_nights varchar(255),
      maximum_nights varchar(255)
  );
  
  drop table if exists ImportH;
  create table ImportH (
  
      url varchar(255),
      name varchar(255),
      description text,
      picture_url varchar(255),
      host_id  varchar(255),
      host_url varchar(255),
      host_name varchar(255),
      host_since varchar(255),
      host_about text,
      host_response_time varchar(255),
      host_response_rate varchar(255),
      host_is_superhost varchar(255),
      host_picture_url varchar(255),
      host_listings_count varchar(255),
      host_verifications varchar(255),
      host_identity_verified varchar(255)
  );
  
  drop table if exists ImportR;
  create table ImportR (
  
      id varchar(255),
      url varchar(255),
      name varchar(255),
      description text,
      picture_url varchar(255),
      street varchar(255),
      neighbourhood varchar(255),
      city varchar(255),
      date_review varchar(255),
      reviewer_id varchar(255),
      reviewer_name varchar(255),
      comments text
  );
  
  copy ImportA from '/Users/Shared/BDD/apartments.csv' csv header delimiter ',';
  copy ImportH from '/Users/Shared/BDD/hosts.csv' csv header delimiter ',';
  copy ImportR from '/Users/Shared/BDD/review.csv' csv header delimiter ',';
  
  drop table if exists Country cascade;
  create table Country (
  
      country_code varchar(255),
      country varchar(255),
      primary key (country_code)
  );
  
  drop table if exists Payment cascade;
  create table Payment (
  
      id_payment serial,
      price money,
      weekly_price money,
      monthly_price money,
      security_deposit money,
      cleaning_fee money,
      primary key (id_payment)
  );
  
  drop table if exists Characteristic cascade;
  create table Characteristic (
  
      id_characteristic serial,
      property_type varchar(255),
      accommodates int,
      bathrooms int,
      bedrooms int,
      beds int,
      square_feet int,
      minimum_nights int,
      maximum_nights int,
      primary key (id_characteristic)
  );
  
  drop table if exists Host cascade;
  create table Host (
  
      host_id int,
      host_url varchar(255),
      host_name varchar(255),
      host_since date,
      host_about text,
      host_response_time varchar(255),
      host_response_rate varchar(255),
      host_is_superhost boolean,
      host_picture_url varchar(255),
      host_listings_count int,
      host_identity_verified boolean,
      primary key (host_id)
  );
  
  drop table if exists Media cascade;
  create table Media (
  
      id_verification serial,
      media varchar(255),
      primary key (id_verification)
  );
  
  drop table if exists RelationHostMedia cascade;
  create table RelationHostMedia (
  
      host_id int,
      id_verification int,
      primary key (host_id, id_verification),
      foreign key (host_id) references Host (host_id),
      foreign key (id_verification) references Media (id_verification)
  );
  
  drop table if exists Amenitie cascade;
  create table Amenitie (
  
      id_amenitie serial,
      id_characteristic int,
      amenitie varchar(255),
      primary key (id_amenitie),
      foreign key (id_characteristic) references Characteristic (id_characteristic)
  );
  
  drop table if exists Place cascade;
  create table Place (
  
      id_place serial,
      street varchar(255),
      neighbourhood varchar(255),
      city varchar(255),
      state varchar(255),
      zipcode varchar(255),
      country_code varchar(255),
      primary key (id_place),
      foreign key (country_code) references Country (country_code)
  );
  
  drop table if exists Apartment cascade;
  create table Apartment (
  
      id_apartment int,
      url varchar(255),
      name varchar(255),
      description text,
      picture_url varchar(255),
      id_place int,
      id_payment int,
      id_characteristic int,
      host_id int,
      primary key (id_apartment),
      foreign key (id_place) references Place (id_place),
      foreign key (id_payment) references Payment (id_payment),
      foreign key (id_characteristic) references Characteristic (id_characteristic),
      foreign key (host_id) references Host (host_id)
  );
  
  drop table if exists Reviewer cascade;
  create table Reviewer (
  
      reviewer_id int,
      reviewer_name varchar(255),
      primary key (reviewer_id)
  );
  
  drop table if exists Review cascade;
  create table Review (
  
      id_review serial,
      reviewer_id int,
      id_apartment int,
      date_review date,
      comments text,
      primary key (id_review),
      foreign key (reviewer_id) references Reviewer (reviewer_id),
      foreign key (id_apartment) references Apartment (id_apartment)
  );
  
  insert into Country (country_code, country)
  select distinct country_code, country
  from ImportA;
  
  insert into Payment (price, weekly_price, monthly_price, security_deposit, cleaning_fee)
  select cast(price as money), cast(weekly_price as money), cast(monthly_price as money), cast(security_deposit as money), cast(cleaning_fee as money)
  from ImportA;
  
  insert into Characteristic (property_type, accommodates, bathrooms, bedrooms, beds, square_feet, minimum_nights, maximum_nights)
  select property_type, cast(accommodates as int), cast(bathrooms as int), cast(bedrooms as int), cast(beds as int), cast(square_feet as int), cast(minimum_nights as int), cast(maximum_nights as int)
  from ImportA;
  
  insert into Host (host_id, host_url, host_name, host_since, host_about, host_response_time, host_response_rate, host_is_superhost, host_picture_url, host_listings_count, host_identity_verified)
  select cast(host_id as int), host_url, host_name, cast(host_since as date), cast(host_about as text), host_response_time, host_response_rate, cast(host_is_superhost as boolean), host_picture_url, cast(host_listings_count as int), cast(host_identity_verified as boolean)
  from ImportH;
  
  insert into Media (media)
  select host_verifications
  from ImportH;
  
  insert into RelationHostMedia (host_id, id_verification)
  select distinct host_id, id_verification
  from Host, Media;
  
  insert into Amenitie (id_characteristic, amenitie)
  select id_characteristic, amenities
  from Characteristic, ImportA;
  
  insert into Place (street, neighbourhood, city, state, zipcode, country_code)
  select street, neighbourhood, city, state, zipcode, country_code
  from ImportA, Country;
  
  insert into Apartment (id_apartment, url, name, description, picture_url, id_place, id_payment, id_characteristic, host_id)
  select cast(id_apartment as int), url, name, cast(description as text), picture_url, id_place, id_payment, id_characteristic, host_idfrom ImportA, Place, Payment, Characteristic, Host;
  
  select id_place from Apartment;
  </code></pre>
  
  <p>This code are just the creation of the Import tables and main tables and also the insertion of data into each table, relating them. Also, I'm not 100% sure this relations are coded fine, I was trying to figure it out by debugging it but the output when I execute it is:</p>
  
  <blockquote>
    <p>ERROR:  invalid input syntax for integer: "1.5"</p>
  </blockquote>
  
  <p>What does this mean? I have checked all my integer atributes and they seem fine nor I have no atribute called "1,5".</p>