public inbox for [email protected]
help / color / mirror / Atom feedRe: Display Bytea field
2+ messages / 2 participants
[nested] [flat]
* Re: Display Bytea field
@ 2025-01-10 12:49 Daniel Verite <[email protected]>
2025-01-10 14:39 ` Re: Display Bytea field Ron Johnson <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Verite @ 2025-01-10 12:49 UTC (permalink / raw)
To: Andy Hartman <[email protected]>; +Cc: [email protected]
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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Display Bytea field
2025-01-10 12:49 Re: Display Bytea field Daniel Verite <[email protected]>
@ 2025-01-10 14:39 ` Ron Johnson <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Ron Johnson @ 2025-01-10 14:39 UTC (permalink / raw)
To: Daniel Verite <[email protected]>; +Cc: Andy Hartman <[email protected]>; [email protected]
On Fri, Jan 10, 2025 at 7:49 AM Daniel Verite <[email protected]>
wrote:
[snip]
> 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.
>
This is what I did when migrating Oracle xLOB columns to bytea. Had to use
upper(md5()).
I didn't suggest this earlier, since I don't know the details of MSSQL's
Image data type.
--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2025-01-10 14:39 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-01-10 12:49 Re: Display Bytea field Daniel Verite <[email protected]>
2025-01-10 14:39 ` Ron Johnson <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox