Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Ypazi-0007Tl-Au for pgsql-admin@arkaria.postgresql.org; Tue, 05 May 2015 11:26:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Ypazh-0003mT-LI for pgsql-admin@arkaria.postgresql.org; Tue, 05 May 2015 11:26:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Ypazg-0003kj-Dm for pgsql-admin@postgresql.org; Tue, 05 May 2015 11:26:32 +0000 Received: from mailout1.go2.pl ([193.17.41.11]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Ypazc-0006ea-Nz for pgsql-admin@postgresql.org; Tue, 05 May 2015 11:26:31 +0000 Received: from mailout1.go2.pl (unknown [10.0.0.103]) by mailout1.go2.pl (Postfix) with ESMTP id C45F45D5161 for ; Tue, 5 May 2015 13:26:24 +0200 (CEST) Received: from o2.pl (unknown [10.0.0.7]) by mailout1.go2.pl (Postfix) with SMTP for ; Tue, 5 May 2015 13:26:24 +0200 (CEST) Subject: =?UTF-8?Q?display_to=5Ftimestamp_in_quotas_?= =?UTF-8?Q?or_convert_to_char?= From: =?UTF-8?Q?czezz?= To: pgsql-admin@postgresql.org Mime-Version: 1.0 Message-ID: <657111c9.5817f52.5548a8e0.89d25@o2.pl> Date: Tue, 05 May 2015 13:26:24 +0200 X-Originator: 84.74.156.204 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Hello, This post might be unreadable in your mail client. If so try to copy it in = to notepad as there is a long query statement. I have following table in the DB. Server2=3D# \d ss21_file Table "srx.ss21_file" Column | Type | Modifiers -------------------+------------------------+----------- value | character varying(30) | fileindex | bigint | filename | character varying(80) | filetime | character varying(100) | filesizeinrecords | bigint | filesizeinbytes | bigint | sourceid | character varying(300) | Indexes: "ss21_filetime" UNIQUE, btree (filetime) When executing following query I get following error: Server2=3D# SELECT value, fileIndex, fileName, fileTime, fileSizeInRecords,= fileSizeInBytes, sourceID FROM ss21_file WHERE filetime < to_timestamp('= 2015-05-04 22:13:14.000', 'YYYY/MM/DD-HH24:MI:SS.FF3'); ERROR: operator does not exist: character varying < timestamp with time zo= ne LINE 1: ...ytes, sourceID FROM ss21_file WHERE filetime < to_times... ^ HINT: No operator matches the given name and argument type(s). You might n= eed to add explicit type casts. My assumption is that, it is because "filetime" column is "character varyin= g" and in WHERE condition value there is converted to timestamp. When I execute this same query but instead to_timestamp I use regular strin= g eg. '2015-05-04 22:13:14.000' (NOTE: single quotas) it works quite good. If this is correct, is there any way to force to_"timestamp" function to be= convertrd in to "character varying" or display its value in single quotas ? Server2=3D# SELECT value, fileIndex, fileName, fileTime, fileSizeInRecords,= fileSizeInBytes, sourceID FROM ss21_file WHERE filetime < '2015-05-04 22= :13:14.000'; value | fileindex | filename |= filetime | filesizeinrecords | filesizeinbytes | = sourceid ----------------------+-----------+---------------------------------------+= -------------------------+-------------------+-----------------+-----------= ------------------ ------- -903097975225368365 | 94859 | ss21_20141118020501_1166.DAT | 2014-11-1= 8 02:05:30.109 | 2775 | 490560 | coll_SS21-Group_0_14= 1627273 0_1634 -2781431802746610881 | 94868 | ss21_20141118042502_1175.DAT | 2014-11-1= 8 04:25:30.154 | 1803 | 310688 | coll_SS21-Group_0_14= 1628113 0_1643 -4731211533677294393 | 94878 | ss21_20141118065501_1185.DAT | 2014-11-1= 8 06:55:30.380 | 14745 | 2640848 | coll_SS21-Group_0_14= 1629013 Best regards, czezz --=20 Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin