pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tarlika Elisabeth Schmitz <postgresql3@numerixtechnology.de>
To: pgsql-sql@postgresql.org
Subject: data import: 12-hour time w/o AM/PM
Date: Tue, 8 Feb 2011 18:14:00 +0000
Message-ID: <20110208181400.2e88d7cc@dick.coachhouse> (raw)

I am importing data in CSV format. My technique is to COPY the data
into interim tables (starting with a "z") where I analyze them, clean
up inconsistencies; eventually I will populate the "proper" tables with
these data. (In the example below: COPY CSV into zevent, from there
populate event.)

The time field of the event data is givng me a headache: it's in 12h
format but without the AM/PM qualifier!

CREATE TABLE zevent
(
  id integer,
  previous integer,
  "next" integer,
  location_id integer NOT NULL,
  datum date NOT NULL,
  otime character varying(5) NOT NULL
)

CREATE TABLE event
(
  id integer NOT NULL,
  location_fk integer NOT NULL,
  otime timestamp without time zone NOT NULL,
  next_fk integer,
  previous_fk integer,
  CONSTRAINT event_pkey PRIMARY KEY (id),
  CONSTRAINT next_event_fk FOREIGN KEY (next_fk)
      REFERENCES event (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT previous_event_fk FOREIGN KEY (previous_fk)
      REFERENCES event (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION
)


From the date and time I want to create a timestamp.
I know that 
- the events take place during the day, say between 10:30 and 22:30
- it's always a set of events at one location spaced about 30min apart
- the imported data are chained (have a link to previous/next event)


Have you got any idea how I could tackle this problem



-- 

Best Regards,
Tarlika Elisabeth Schmitz



view thread (6+ messages)  latest in thread

Message-ID: <20110208181400.2e88d7cc@dick.coachhouse>
Permalink:  ../20110208181400.2e88d7cc@dick.coachhouse/
Also on:    postgresql.org/message-id/20110208181400.2e88d7cc@dick.coachhouse

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: postgresql3@numerixtechnology.de
  Subject: Re: data import: 12-hour time w/o AM/PM
  In-Reply-To: <20110208181400.2e88d7cc@dick.coachhouse>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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