I moved a table from MsSql to Postgresql that had a field defined as Image in Mssql now in Postgres it's a Bytea field. How can I make sure data copied across with success?
Is there some code I could run to make sure Image looks correct from PostgreSQL ?
Thanks.
January 11, 2025 at 11:10 am
Thanks for posting your issue and hopefully someone will answer soon.
This is an automated bump to increase visibility of your question.
January 11, 2025 at 11:26 am
The first thought would be to compare a hash of the two, i.e. SHA2_256, those should match.
😎
January 11, 2025 at 11:51 am
do you have any code to do that compare?
In MS SQL Server, you'll use the HASHBYTES function and in PostgreSQL, you'll use the sha256 function or any of the other string/binary functions that match the algorithm choice used for HASHBYTES.
😎
Note that for an equal input, these functions should produce the same output, start by asserting this using the same static value on both platforms!
Please post your attempts on a new thread if you run into any problems 😉
January 12, 2025 at 2:35 pm
When I dumped the data from mssql to csv I used this piece for the Image field.
# Convert the image data to a base64 string
$base64Image = [Convert]::ToBase64String($row.ImageSource)
It seems from my developer the image in Postgres size is smaller than from the mssql table.
After I created the csv I used the COPY to load csv to Postgres.
Any thoughts help
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply