Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 8CDE91337999 for ; Tue, 8 Feb 2011 14:15:24 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 73399-08 for ; Tue, 8 Feb 2011 18:15:17 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from zebedee.cranntara.net (unknown [91.186.7.81]) by mail.postgresql.org (Postfix) with ESMTP id 096AA1337B47 for ; Tue, 8 Feb 2011 14:15:16 -0400 (AST) Received: from [88.210.158.208] (helo=bolek.coachhouse) by zebedee.cranntara.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1Pms53-00052T-1b for pgsql-sql@postgresql.org; Tue, 08 Feb 2011 18:14:26 +0000 Received: from [192.168.0.32] (helo=dick.coachhouse ident=tarlika) by bolek.coachhouse with esmtp (Exim 4.69) (envelope-from ) id 1Pms4e-0003Zu-LX for pgsql-sql@postgresql.org; Tue, 08 Feb 2011 18:14:00 +0000 Date: Tue, 8 Feb 2011 18:14:00 +0000 From: Tarlika Elisabeth Schmitz To: pgsql-sql@postgresql.org Subject: data import: 12-hour time w/o AM/PM Message-ID: <20110208181400.2e88d7cc@dick.coachhouse> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.12; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.107 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RDNS_NONE=0.793 X-Spam-Level: X-Archive-Number: 201102/33 X-Sequence-Number: 35109 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 ) =46rom the date and time I want to create a timestamp. I know that=20 - 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 --=20 Best Regards, Tarlika Elisabeth Schmitz