Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k4jpw-0000c3-AJ for pgsql-general@arkaria.postgresql.org; Sun, 09 Aug 2020 11:50:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k4jpv-0004yt-9H for pgsql-general@arkaria.postgresql.org; Sun, 09 Aug 2020 11:49:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k4jpu-0004ym-6A for pgsql-general@lists.postgresql.org; Sun, 09 Aug 2020 11:49:59 +0000 Received: from stz-bg.com ([46.40.123.212] helo=mail.stzbg.com) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k4jpo-0002ZF-Rd for pgsql-general@lists.postgresql.org; Sun, 09 Aug 2020 11:49:57 +0000 Received: from www.stz-bg.com (stz-bg.com [IPv6:2a02:6800:0:99::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: condor@stz-bg.com) by mail.stzbg.com (Postfix) with ESMTPSA id E82B82E0B6A; Sun, 9 Aug 2020 14:49:49 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stz-bg.com; s=mail; t=1596973791; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sMtz4THKE3fakAunZabKA9RDvAGPLfC7aFdiErm5+Jc=; b=eEPc0jjM1zEXxWLzk5rrmKt9IxHRQ7K5v61GaEhHFjHbUBPmsNdGImWLCfeorZJMVoFZ9h 6YCcLQRjKtXXNDA6NvqdbCWyVJv1JM7/jEIkxVxJuueyoCsTQUzL/u5BeIRoqyvhhQUcWw H6DsyqtJlzUusjg785Kd7jiZhqoLSvs= MIME-Version: 1.0 Date: Sun, 09 Aug 2020 14:49:49 +0300 From: Condor To: Ashesh Vashi Cc: pgsql-general@lists.postgresql.org Subject: Re: Need help how to reproduce MySQL binary to PosgreSQL In-Reply-To: References: <6ba79f0a4d46b6298b14749369df538a@stz-bg.com> User-Agent: Roundcube Webmail/1.4.7 Message-ID: <1f30d97d75f41e09f64a23a5e49dfa1f@stz-bg.com> X-Sender: condor@stz-bg.com Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 09-08-2020 09:20, Ashesh Vashi wrote: > Hi, > > Have you checked this? > https://stackoverflow.com/questions/44813386/mysqls-hex-and-unhex-equivalent-in-postgres > > -- > > Thanks & Regards, > > Ashesh Vashi > EnterpriseDB INDIA: Enterprise PostgreSQL Company [1] > > _http://www.linkedin.com/in/asheshvashi_ [2] > > On Sun, Aug 9, 2020 at 11:42 AM Condor wrote: > >> Hello, >> >> how I can reproduce MySQL binary to PosgreSQL and use follow >> functionality in PG. >> >> On mysql I have table with 3 fields: >> >> CREATE TABLE table ( >> user_id int, >> user_info binary(4), >> user_data binary(16) >> ); >> >> then I use them for example: >> >> UPDATE table set user_info = CHAR(0, 2, 0, 0), user_data = CHAR(123, >> 1, >> 0, 2) WHERE user_id = 1; >> >> select and insert them as: >> >> SELECT HEX(user_info) AS user_info, HEX(user_data) AS user_data FROM >> >> table; >> INSERT INTO table (user_info, user_data) VALUES >> (UNHEX(hexdata_commng_from_app), UNHEX(hexdata_commng_from_app)); >> >> I check PG does not have functions HEX and UNHEX. Some one can help >> a >> little ? >> >> Regards, >> HS > > Yea, I checked it, but because is 3 years old solution I expect these functions to be implemented long ago and just have another names or to have similar functions that do the same functionality. It's seems not, Okay will use the solution from sof. Regards, HS