Thread: Syncing Data of data type BLOB into Postgres- Bytea

Syncing Data of data type BLOB into Postgres- Bytea

From
Cynthia Hombakazi Ngejane
Date:
Hello Everyone,

I have two databases SQLlite and Postgres,  SQLite is my local database in it I am saving fingerprint templates that get capture on site (offline) and my column is of type BLOB. Now I want to sync these templates into Postgres (to the server), so I created a column of type bytea but Postgres is refusing to take BLOB it says there was a syntax error. I am using Qt c++ 5.7  application  to do the syncing.

Please Help...

CH Ngejane

Re: Syncing Data of data type BLOB into Postgres- Bytea

From
John DeSoi
Date:
> On Nov 10, 2016, at 12:55 AM, Cynthia Hombakazi Ngejane <hombakazi.ngejane@gmail.com> wrote:
>
> I have two databases SQLlite and Postgres,  SQLite is my local database in it I am saving fingerprint templates that
getcapture on site (offline) and my column is of type BLOB. Now I want to sync these templates into Postgres (to the
server),so I created a column of type bytea but Postgres is refusing to take BLOB it says there was a syntax error. I
amusing Qt c++ 5.7  application  to do the syncing. 

It is going to be hard to help without seeing the exact code you are using to insert and the exact error message you
areseeing. 

John DeSoi, Ph.D.



Re: Syncing Data of data type BLOB into Postgres- Bytea

From
Adrian Klaver
Date:
On 11/15/2016 05:55 PM, John DeSoi wrote:
>
>> On Nov 10, 2016, at 12:55 AM, Cynthia Hombakazi Ngejane <hombakazi.ngejane@gmail.com> wrote:
>>
>> I have two databases SQLlite and Postgres,  SQLite is my local database in it I am saving fingerprint templates that
getcapture on site (offline) and my column is of type BLOB. Now I want to sync these templates into Postgres (to the
server),so I created a column of type bytea but Postgres is refusing to take BLOB it says there was a syntax error. I
amusing Qt c++ 5.7  application  to do the syncing. 
>
> It is going to be hard to help without seeing the exact code you are using to insert and the exact error message you
areseeing. 

Part of the issue is that BLOB in SQLite does not actually mean anything:

http://sqlite.org/datatype3.html

"(Historical note: The "BLOB" type affinity used to be called "NONE".
But that term was easy to confuse with "no affinity" and so it was
renamed.) "

....

"A column with affinity BLOB does not prefer one storage class over
another and no attempt is made to coerce data from one storage class
into another."

So you can stick anything you want in there, which actually is true of
any SQLite 'type'. So the OP is going from inserting into
something(SQLite) that does no input validation to one(Postgres) that does.

>
> John DeSoi, Ph.D.
>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com