Jump to content
Mark Williams

FireDAC Postgres ByteA field

Recommended Posts

I am using Array DML to post data to a postgres table. One of the fields is of type bytea.

 

I have tried setting the datatype for the relevant query parameter toftBlob. This fails with the error:

Quote

[FireDAC][Phys][PG]-352. Object value for [PAGES] parameter of [ftBlob] type is not supported

I have tried setting the datatype for the query parameter to the same TFieldType as the field in the FireDAC dataset. I get the same error, so it would seem the field is a blob field.

 

Code below:

Query2,Params[3].DataType:=ftBlob;
Query2Params[3].AsStream:=CreateBlobStream(Fields[ages], bmRead);

 

Share this post


Link to post

Could you please add column definition from this table (ddl) and the query statement?

Share this post


Link to post

The column definition is

ALTER TABLE public.bundles
	Add COLUMN pages bytea;

The query statement

INSERT INTO bundles (pages) VALUES(:P)

 

Share this post


Link to post

bytea is not standard blob, more like a string, encoded to cover every case of special chars or nulls. There are large objects in pg, but this type has even less support.

 

try using ftStream instead of ftBlob

Look up some special flags for pg blob connection in Emba docs.

 

If your data is "close to text" which could be the case reading "pages", you also might try another column type like text or even json/jsonb.

Share this post


Link to post

Thanks for the info. I gave up on byteA in the end. The data is an array of numbers. I now save it to csv and in a text field and then restore it to an array when needed. There does not seem to be any appreciable loss of speed. Would have certainly looked at ftStream otherwise.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×