Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gAP9l-0002BK-6w for pgsql-general@arkaria.postgresql.org; Thu, 11 Oct 2018 00:48:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gAP9i-0007fG-NB for pgsql-general@arkaria.postgresql.org; Thu, 11 Oct 2018 00:48:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gAP9g-0007da-Uz for pgsql-general@lists.postgresql.org; Thu, 11 Oct 2018 00:48:46 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gAP9V-0004qa-NI for pgsql-general@lists.postgresql.org; Thu, 11 Oct 2018 00:48:44 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 9F6E820CA5; Wed, 10 Oct 2018 20:48:31 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 10 Oct 2018 20:48:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=y DW22GI6M8mVUlx6MIuYgx7jnzTXUbfG2er+psT5Wco=; b=BY7kud02UlDBffUV2 aZHqLHUkV0u/GV9iYD3/CBFlUU+KCTrQT4PP7kgDxMvxaM1DRIHuvfF6LRd5tFdl hBH60AydlvcKLJKrL/QKzZg9GwOZcZOmnMBKzPtp7sXswOgJAOQMJvB812Oux905 4rMUKaU6c27U3uPi5rTL/SkTc5mBDPFbJ++8xytgObXhzNTzM/4m6tEGPRTohot3 5Gqy+73EWArFdvM9k9BcQ3gop/yWX+nvV1FFk531V9TiHT64GQoOObQ6jhaDlzI9 r3kINFMmB+noUgWojxhy6QhrFSTxODGnPhXbZN9MvQST+iB6uiXxXhXblXDlF+Ix sYMQQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=yDW22GI6M8mVUlx6MIuYgx7jnzTXUbfG2er+psT5W co=; b=KEX83fL9NFuyWAPmaqSQqvF0OsJlB6rw3XupYxURNJjCfDimBRk7QJh31 sVzZUJUuF+AvSV3kIDoo7ze7XFJ0U5mvUY+abDaCpBMx2vbhkG9QQd3Go+NLkqrs Webisn8KRkQiIygG//Gdo7Jj9R5VvqVVH1V9ZpHxXEZtuVdfY6NCNzxnUHyLhV4X bt7VcELXpSawFHvRl+InC+ySbmqUmFFuzYbI2mVRnyTnB7abc8/l0xBSweK4QeuH pyRrwo7HrmNRrhQ4tuL+KZckpw5Ze4mX0XKsAigyOF8LJwpSnQEmkSX8wMSsx+kY FLQ+V+UepLoa+g0xuAQK+Xf3WuonA== X-ME-Sender: X-ME-Proxy: Received: from [192.168.1.3] (unknown [71.212.134.3]) by mail.messagingengine.com (Postfix) with ESMTPA id D7FEEE4240; Wed, 10 Oct 2018 20:48:30 -0400 (EDT) Subject: Re: tds_fdw binary column To: =?UTF-8?B?QWxlxaEgWmVsZW7DvQ==?= Cc: pgsql-general@lists.postgresql.org References: <3493607d-43aa-f4a9-b669-09ec91c67ff3@aklaver.com> <3954c9a7-51d9-7157-941d-79b673bdc19a@aklaver.com> From: Adrian Klaver Message-ID: Date: Wed, 10 Oct 2018 17:48:30 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 10/10/18 12:20 PM, Aleš Zelený wrote: > Hello, thanks for the testcase! > > Test cases with added msg_handler > > test_get_some_id) > Thanks to chosen small table, it fast enough: > > =# select branch_id from ase.tds_tbl where branch_id::text = > '\x00038500875c3d60'; > NOTICE:  DB-Library notice: Msg #: 5701, Msg state: 2, Msg: Changed > database context to 'customer'. > , Server: FMI0MA1, Process: , Line: 0, Level: 0 > NOTICE:  DB-Library notice: Msg #: 5701, Msg state: 1, Msg: Changed > database context to 'vendor'. > , Server: FMI0MA1, Process: , Line: 1, Level: 0 > NOTICE:  tds_fdw: Query executed correctly > NOTICE:  tds_fdw: Getting results > NOTICE:  DB-Library notice: Msg #: 5701, Msg state: 2, Msg: Changed > database context to 'customer'. > , Server: FMI0MA1, Process: , Line: 0, Level: 0 > NOTICE:  DB-Library notice: Msg #: 5701, Msg state: 1, Msg: Changed > database context to 'vendor'. > , Server: FMI0MA1, Process: , Line: 1, Level: 0 > ┌────────────────────┐ > │     branch_id      │ > ├────────────────────┤ > │ \x00038500875c3d60 │ > └────────────────────┘ > (1 row) > > Time: 38.673 ms > > We get ID used in later tests: > > test_bytea_predicate) > =# select branch_id from ase.tds_tbl where branch_id = > E'\\x00038500875c3d60'::bytea; > NOTICE:  DB-Library notice: Msg #: 5701, Msg state: 2, Msg: Changed > database context to 'customer'. > , Server: FMI0MA1, Process: , Line: 0, Level: 0 > NOTICE:  DB-Library notice: Msg #: 5701, Msg state: 1, Msg: Changed > database context to 'vendor'. > , Server: FMI0MA1, Process: , Line: 1, Level: 0 > NOTICE:  DB-Library notice: Msg #: 102, Msg state: 181, Msg: Incorrect > syntax near 'E'. > , Server: FMI0MA1, Process: , Line: 1, Level: 15 > ERROR:  DB-Library error: DB #: 102, DB Msg: General SQL Server error: > Check messages from the SQL Server, OS #: -1, OS Msg: , Level: 15 > Time: 0.209 ms > > Failed as expected after previous tests, but we have new message: > Incorrect syntax near 'E'. > Might be some issue with cast handling??? No with the escape syntax, E' is a Postgres extension. See: https://www.postgresql.org/docs/10/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS 4.1.2.2. String Constants with C-style Escapes The text cast in your previous example seems to work. Is there an issue with using that. If there is I would file an issue here: https://github.com/tds-fdw/tds_fdw/issues > > test_bytea_predicate_to_bytea) > [local]:5432 postgres@postgres:13550 > =# select branch_id from ase.tds_tbl where branch_id = (select branch_id > from ase.tds_tbl where branch_id::text = '\x00038500875c3d60'); > NOTICE:  DB-Library notice: Msg #: 5701, Msg state: 2, Msg: Changed > database context to 'customer'. > , Server: FMI0MA1, Process: , Line: 0, Level: 0 > NOTICE:  DB-Library notice: Msg #: 5701, Msg state: 1, Msg: Changed > database context to 'vendor'. > , Server: FMI0MA1, Process: , Line: 1, Level: 0 > NOTICE:  tds_fdw: Query executed correctly > NOTICE:  tds_fdw: Getting results > NOTICE:  DB-Library notice: Msg #: 5701, Msg state: 2, Msg: Changed > database context to 'customer'. > , Server: FMI0MA1, Process: , Line: 0, Level: 0 > NOTICE:  DB-Library notice: Msg #: 5701, Msg state: 1, Msg: Changed > database context to 'vendor'. > , Server: FMI0MA1, Process: , Line: 1, Level: 0 > NOTICE:  DB-Library notice: Msg #: 2715, Msg state: 1, Msg: Can't find > type 'bytea'. > , Server: FMI0MA1, Process: , Line: 1, Level: 16 > ERROR:  DB-Library error: DB #: 2715, DB Msg: General SQL Server error: > Check messages from the SQL Server, OS #: -1, OS Msg: , Level: 16 > Time: 0.249 ms > > The error is different, it looks tds_fdw is trying use bytea dat type > fro ASE query (guess). > > That is what I was able to test. > > Kind regards > Ales Zeleny > > st 10. 10. 2018 v 15:30 odesílatel Adrian Klaver > > napsal: > > On 10/10/18 1:31 AM, Aleš Zelený wrote: > > Hello, > > > > my fault, I've forgot to mention that I have only DSN and database > > user/password credentials with no access to the box with Sybase. > trying > > to reach service vendor support,  but it might take some time and I > > hoped I've done some mistake on my side... > > Hmm, some digging found this: > > https://github.com/tds-fdw/tds_fdw/issues/88 > > If your credentials allow it you might try the suggestion in the above > to see if you can get a more detailed error message. > > > > > Kind Regards > > Ales Zeleny > > > > -- > Adrian Klaver > adrian.klaver@aklaver.com > -- Adrian Klaver adrian.klaver@aklaver.com