Search code examples
postgresqlinsertvarbinary

Write query for inserting varbinary value in PostgreSQL


What is the syntax in PostgreSQL for inserting varbinary values?

SQL Server's syntax using a constant like 0xFFFF, it didn't work.


Solution

  • Given there's no "varbinary" data type in Postgres I believe you mean "bytea". Take a look at the docs about the way to specify "bytea" literals.

    Depending on the language and the bindings you use there could be more sophisticated ways for transferring binary data - you could find a .Net/C#/Npgsql example here (under "Working with binary data and bytea datatype").