Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id B4B6C1337B54 for ; Wed, 6 Oct 2010 08:11:11 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 37420-02 for ; Wed, 6 Oct 2010 11:11:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com [209.85.216.181]) by mail.postgresql.org (Postfix) with ESMTP id 78D241336971 for ; Wed, 6 Oct 2010 08:11:04 -0300 (ADT) Received: by qyk10 with SMTP id 10so3874814qyk.19 for ; Wed, 06 Oct 2010 04:11:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=cg8M+QyCBgeSaLeHmh9EoiyvoKkuxpRJB7uaUWw+Qu8=; b=i8wvKjBHhXkvvT7GiC1UT5So6emLmHZgdmK8OSbF5FY8SL4isEo6nxhpIVIJTJxXXk Mkc5WH6FjzEczU2EM1qbl+jC2FvjLBmp4tPZyvSJuEWGyKX73ZaGHceevSsEu83Kc6x/ 5eK8MdDgmMEEAsVrIqXimXCX/lzoMoulP/b4I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=HDZtYET6PgQlvd2UQ8yZEauYHFWMzRvjKqiySz8uhtn8y+F7ZwhdVAQ7bM60zxdjNS kCC/lktdhj8Sx6LeAcJh91wQjUwM+SxSTW8KThDlexxr5U7Ldt4mIiFu/vpbb95ykSjn slM3U//VX7y+xk34JUayULR8EmGY2NmGZXvo8= MIME-Version: 1.0 Received: by 10.224.74.81 with SMTP id t17mr9367427qaj.122.1286363464679; Wed, 06 Oct 2010 04:11:04 -0700 (PDT) Received: by 10.229.246.80 with HTTP; Wed, 6 Oct 2010 04:11:04 -0700 (PDT) Date: Wed, 6 Oct 2010 13:11:04 +0200 Message-ID: Subject: Create Datefield from 3 fields From: =?ISO-8859-1?Q?Andreas_For=F8_Tollefsen?= To: pgsql-sql@postgresql.org Content-Type: multipart/alternative; boundary=0015175cd1da5d42f50491f0d518 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-5 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201010/15 X-Sequence-Number: 34666 --0015175cd1da5d42f50491f0d518 Content-Type: text/plain; charset=ISO-8859-1 Hi. I am trying to create a datefield using YEAR, MONTH and DAY fields of type integer. I tried this query, but it did not give good results: select to_date(gwsyear::text || gwsmonth::text || gwsday::text, 'YYYY-MM-DD') FROM cshapes "1966526-01-01" "7991903-12-13" "1962831-01-01" "194611-01-01" "196211-01-01" Any ideas on how to do this? --0015175cd1da5d42f50491f0d518 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi.

I am trying to create a datefield using YEAR, MONTH = and DAY fields of type integer.
I tried this query, but it did no= t give good results:
select to_date(gwsyear::text || gwsmont= h::text || gwsday::text, 'YYYY-MM-DD') FROM cshapes
"1966526-01-01"
"7991903-12-13&quo= t;
"1962831-01-01"
"194611-01-01"
"196211-01-01"

Any ideas = on how to do this?
--0015175cd1da5d42f50491f0d518--