public inbox for [email protected]
help / color / mirror / Atom feedFrom: Daniel Verite <[email protected]>
To: Andy Hartman <[email protected]>
Cc: [email protected]
Subject: Re: Display Bytea field
Date: Fri, 10 Jan 2025 13:49:40 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAEZv3copeUd7mNf98qxBtkqqW=g3MtCJe62jdMEEzFC4M=-+4A@mail.gmail.com>
Andy Hartman wrote:
> How thru a simple query can I make sure data matches and I can display it
>
> On Thu, Jan 9, 2025 at 3:16 PM Andy Hartman <[email protected]> wrote:
>
> > 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,
--
Daniel Vérité
https://postgresql.verite.pro/
Twitter: @DanielVerite
view thread (2+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Display Bytea field
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox