Search Postgresql Archives

Re: Bytea Example

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/16/20 10:10 AM, Naveen Kumar wrote:
sorry for the late reply. Below is my issue:

I am connected to PostgreSQL in a Windows environment. Below is my version:

*"PostgreSQL 12.3, compiled by Visual C++ build 1914, 64-bit"*

I am just trying to practice LOB objects, like byteA data type, in PostgreSQL. Unfortunately, I didn't find good links regarding this so I raised the issue. Nothing else I am doing.

Some simple examples:

create table bytea_test(byte_fld bytea);

insert into bytea_test values('\xDEADBEEF');

select * from bytea_test ;
  byte_fld
------------
 \xdeadbeef

insert into bytea_test values(decode('test string', 'escape'));

select * from bytea_test ;
         byte_fld
--------------------------
 \xdeadbeef
 \x7465737420737472696e67

select encode(byte_fld, 'escape') from bytea_test ;
      encode
------------------
 \336\255\276\357
 test string

From docs:

https://www.postgresql.org/docs/12/datatype-binary.html

https://www.postgresql.org/docs/12/functions-binarystring.html

As pointed out by Francisco Olarte the above generally does not happen directly in database. Usually you are using some external program to convert the binary data into some form of bytea.


Thank you one and all !!

Thanks & Regards
Naveen



On Thu, Aug 13, 2020 at 7:34 PM Adrian Klaver <adrian.klaver@xxxxxxxxxxx <mailto:adrian.klaver@xxxxxxxxxxx>> wrote:

    On 8/13/20 6:56 AM, Naveen Kumar wrote:
     > I am not using any programming language. I am simply using
    PostgreSQL 12
     > version that's all

    I'm having a hard time figuring out how you are migrating from
    Oracle to
    Postgres without using at least SQL and some sort of driver to pull out
    of one and push into the other.

     >
     > On Thu, Aug 13, 2020 at 7:21 PM Adrian Klaver
    <adrian.klaver@xxxxxxxxxxx <mailto:adrian.klaver@xxxxxxxxxxx>
     > <mailto:adrian.klaver@xxxxxxxxxxx
    <mailto:adrian.klaver@xxxxxxxxxxx>>> wrote:
     >
     >     On 8/13/20 6:49 AM, Naveen Kumar wrote:
     >      > I am trying to migrate the database from Oracle to PostgreSQL
     >
     >     The question was:
     >
     >     What programming language and database driver are you using?
     >
     >      >
     >      > On Thu, Aug 13, 2020 at 7:17 PM Adrian Klaver
     >     <adrian.klaver@xxxxxxxxxxx <mailto:adrian.klaver@xxxxxxxxxxx>
    <mailto:adrian.klaver@xxxxxxxxxxx <mailto:adrian.klaver@xxxxxxxxxxx>>
     >      > <mailto:adrian.klaver@xxxxxxxxxxx
    <mailto:adrian.klaver@xxxxxxxxxxx>
     >     <mailto:adrian.klaver@xxxxxxxxxxx
    <mailto:adrian.klaver@xxxxxxxxxxx>>>> wrote:
     >      >
     >      >     On 8/13/20 6:40 AM, Naveen Kumar wrote:
     >      >      > Can someone please give me an example on byteA data
    type.
     >      >      >
     >      >      > 1. How to import a image/text file into Bytea data
    type.?
     >      >      > 2. How to export the same?
     >      >
     >      >     What programming language and database driver are you
    using?
     >      >
     >      >     --
     >      >     Adrian Klaver
     >      > adrian.klaver@xxxxxxxxxxx
    <mailto:adrian.klaver@xxxxxxxxxxx> <mailto:adrian.klaver@xxxxxxxxxxx
    <mailto:adrian.klaver@xxxxxxxxxxx>>
     >     <mailto:adrian.klaver@xxxxxxxxxxx
    <mailto:adrian.klaver@xxxxxxxxxxx> <mailto:adrian.klaver@xxxxxxxxxxx
    <mailto:adrian.klaver@xxxxxxxxxxx>>>
     >      >
     >
     >
     >     --
     >     Adrian Klaver
     > adrian.klaver@xxxxxxxxxxx <mailto:adrian.klaver@xxxxxxxxxxx>
    <mailto:adrian.klaver@xxxxxxxxxxx <mailto:adrian.klaver@xxxxxxxxxxx>>
     >


-- Adrian Klaver
    adrian.klaver@xxxxxxxxxxx <mailto:adrian.klaver@xxxxxxxxxxx>



--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux