Обсуждение: Oid data type question

Поиск
Список
Период
Сортировка

Oid data type question

От
Farren Isaacs
Дата:
I'm relatively new to psql.  I have created a database with Oid data
types
in it.  I am now trying to populate the tables with data, from a file
but
I am not sure how to get the path names into the Oid fields.  I have
tried
commands like:

insert into gene values('cI', '1', lo_import('filename1'),
lo_import('filename2'), 'control');

This has not worked, please help.  Any help is appreciated.

Re: Oid data type question

От
Karel Zak
Дата:
On Thu, 13 Apr 2000, Farren Isaacs wrote:

> I'm relatively new to psql.  I have created a database with Oid data
> types
> in it.  I am now trying to populate the tables with data, from a file
> but
> I am not sure how to get the path names into the Oid fields.  I have
> tried
> commands like:
>
> insert into gene values('cI', '1', lo_import('filename1'),
> lo_import('filename2'), 'control');

 A lo_xxxxx() in standard query works on backend's host disk only.

 a example:

test=# create table tab (data text, lo oid);
CREATE
test=# insert into tab values ('my new data', lo_import('/tmp/aaa'));
INSERT 179545 1
test=# select * from tab;
    data     |   lo
-------------+--------
 my new data | 179531
(1 row)


 If you want use LO in backend<->frondend connection you must use LO API
(example in C/PHP/Perl..etc) or you can use new (7.0) pgsql client.


                            Karel