Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tWESQ-00F9W5-Sz for pgsql-general@arkaria.postgresql.org; Fri, 10 Jan 2025 12:49:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tWESQ-00G3gy-9j for pgsql-general@arkaria.postgresql.org; Fri, 10 Jan 2025 12:49:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tWESP-00G3gq-VJ for pgsql-general@lists.postgresql.org; Fri, 10 Jan 2025 12:49:45 +0000 Received: from dverite2024.planet-service.net ([185.16.44.252] helo=mail.verite.pro) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tWESN-000sYb-1c for pgsql-general@lists.postgresql.org; Fri, 10 Jan 2025 12:49:44 +0000 Received: by mail.verite.pro (Postfix, from userid 1000) id 546A32C8416; Fri, 10 Jan 2025 13:49:41 +0100 (CET) Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: Display Bytea field From: "Daniel Verite" To: "Andy Hartman" Cc: pgsql-general@lists.postgresql.org In-Reply-To: Date: Fri, 10 Jan 2025 13:49:40 +0100 Message-Id: <1309d698-fa5f-493e-809a-fd6d95d913b6@manitou-mail.org> X-Mailer: Manitou v1.7.3 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andy Hartman wrote: > How thru a simple query can I make sure data matches and I can display it >=20 > On Thu, Jan 9, 2025 at 3:16=E2=80=AFPM Andy Hartman wrote: >=20 > > I have migrated over a Table from Mssql that had an Image column I now > > have it in Postgres Within psql, the bytea field can be copied into a large object with lo_from_bytea() [1], and then the large object exported into a local file with \lo_export [2] Alternatively, you could compare image checksums before and after moving them into postgres. The advantage is that you don't need to export or view any file, and you compare globally all your images. If the checksums are identical, the data are identical. On the MSSQL side, checksums can be computed with hashbytes() as suggested in this stackoverflow answer: [3] On the postgres side, use functions like md5() or sha256() directly on the bytea column. [1] https://www.postgresql.org/docs/current/lo-funcs.html [2] https://www.postgresql.org/docs/current/app-psql.html#APP-PSQL-META-COMMAND= -LO-EXPORT [3] https://stackoverflow.com/a/33256990/ Best regards, --=20 Daniel V=C3=A9rit=C3=A9 https://postgresql.verite.pro/ Twitter: @DanielVerite