Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id D872D2E00AF for ; Fri, 25 Jan 2008 15:06:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 58652-01 for ; Fri, 25 Jan 2008 15:06:26 -0400 (AST) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.240]) by postgresql.org (Postfix) with ESMTP id E6E8B2E00AD for ; Fri, 25 Jan 2008 15:06:27 -0400 (AST) Received: by an-out-0708.google.com with SMTP id c36so180194ana.33 for ; Fri, 25 Jan 2008 11:06:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=O5MsTeCj+XDI3q+BVPmu1dVuDb+Wcr4xWPcqszZ988w=; b=SQ9jpXLeRnB4o4KguWNHxupvF7/xSSE2AYlud15Fb2EfjSPctE9QrYeOH84jo84KE7jL0zcqqVlNTEp993hdRWkBrWaMXYe/6iOnuIaHMJWXOLB3xUJbpecYvdeDcfmhtszK5n9vz6jPP+cojhGHOW7+BEml4vK8ycVqFdffZxM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=SasrLH7DKWG9ay86i4Hj1YYIiD4j0BUNBNLpAePkAI6YgVjvrh+eQZ3MQ7RS9/+2VU5YQktKYn4Iyqy2GWS8sRsBIHa/8LYPknIwk9sS7SpN/2H/ZSjVqxwZpm4/ZaAQb8xXt8/8HWjYAOB2CSsQXuF9BC4e6InLDmQGdkt/NaU= Received: by 10.100.242.20 with SMTP id p20mr4970623anh.1.1201287987184; Fri, 25 Jan 2008 11:06:27 -0800 (PST) Received: by 10.100.92.16 with HTTP; Fri, 25 Jan 2008 11:06:27 -0800 (PST) Message-ID: <95f6bf9b0801251106h6577fa94j508574db50030b53@mail.gmail.com> Date: Fri, 25 Jan 2008 20:06:27 +0100 From: "Marcin Krawczyk" To: pgsql-sql@postgresql.org Subject: age() function usage MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1345_15183591.1201287987183" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/202 X-Sequence-Number: 30055 ------=_Part_1345_15183591.1201287987183 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi all. I am trying to determine the way to pass a variable/field value to an age() function, query looks something like: SELECT age(timestamp data_zakonczenia_fakt) FROM kip_pracownicy_umowy WHERE id_pracownika = 8 data_zakonczenia_fakt being char column equal to say '1993-11-30'. Such approach won't work, can anyone tell me the way to do it? SELECT age(timestamp '1993-11-30') works great. Same story with age(timestamp '2008-01-01', timestamp '1993-11-30'). Thanks in advance mk ------=_Part_1345_15183591.1201287987183 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi all. I am trying to determine the way to pass a variable/field value to an age() function, query looks something like:

SELECT age(timestamp data_zakonczenia_fakt) FROM kip_pracownicy_umowy WHERE id_pracownika = 8

data_zakonczenia_fakt being char column equal to say '1993-11-30'.
Such approach won't work, can anyone tell me the way to do it?

SELECT age(timestamp '1993-11-30') works great.
Same story with age(timestamp '2008-01-01', timestamp '1993-11-30').

Thanks in advance
mk
------=_Part_1345_15183591.1201287987183--