Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TxxzO-000739-Vd for pgsql-sql@arkaria.postgresql.org; Wed, 23 Jan 2013 10:55:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TxxzO-0006Yv-GV for pgsql-sql@arkaria.postgresql.org; Wed, 23 Jan 2013 10:55:30 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TxxzN-0006Yq-Mf for pgsql-sql@postgresql.org; Wed, 23 Jan 2013 10:55:29 +0000 Received: from smtp-sofia.digsys.bg ([193.68.3.230]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TxxzL-0007Pk-O6 for pgsql-sql@postgresql.org; Wed, 23 Jan 2013 10:55:29 +0000 Received: from luke.digsys.bg (luke.digsys.bg [193.68.6.22]) by smtp-sofia.digsys.bg (8.14.5/8.14.5) with ESMTP id r0NAtJNU055262 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Wed, 23 Jan 2013 12:55:21 +0200 (EET) (envelope-from kaloyan@digsys.bg) Message-ID: <50FFC180.80507@digsys.bg> Date: Wed, 23 Jan 2013 12:54:56 +0200 From: Kaloyan Iliev Reply-To: kaloyan@digsys.bg User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130114 Thunderbird/17.0.2 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Problem with extract(epoch from interval ... Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Hi, I have a little problem with extract epoch from interval. It seems that the query works if the interval is in a string but not from DB field. Could someone provide support. Thanks in advance. Best regards, Kaloyan Iliev db=# begin; BEGIN db=# SELECT version(); version ------------------------------------------------------------------------------------------------------------- PostgreSQL 9.1.6 on amd64-portbld-freebsd9.1, compiled by cc (GCC) 4.2.1 20070831 patched [FreeBSD], 64-bit (1 row) db=# SELECT EXTRACT(EPOCH FROM INTERVAL '3 months'); date_part ----------- 7776000 (1 row) db=# CREATE TABLE a( b interval); CREATE TABLE db=# INSERT INTO a VALUES ('1 month'); INSERT 0 1 db=# INSERT INTO a VALUES ('3 month'); INSERT 0 1 db=# INSERT INTO a VALUES ('6 month'); INSERT 0 1 dbr=# SELECT extract(EPOCH FROM INTERVAL b) FROM a; ERROR: syntax error at or near "b" LINE 1: SELECT extract(EPOCH FROM INTERVAL b) FROM a; -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql