Thread: psql and \lo_import

psql and \lo_import

From
Howard Lowndes
Date:
I'm working psql v7.2.2 to postmaster v7.2.2 and want to use the
\lo_import function.

The psql manual says that the syntax is \lo_import '<filename>' 'comment'

This loads the blob OK and returns the loid but the comment gets lost and
doesn't appear when I run \lo_list

Any ideas?

--
Howard.
LANNet Computing Associates - Your Linux people <http://www.lannetlinux.com>
------------------------------------------
Flatter government, not fatter government - Get rid of the Australian states.
------------------------------------------
If all economists were laid end to end, they would not reach a conclusion
- George Bernard Shaw


Re: psql and \lo_import

From
Tom Lane
Date:
Howard Lowndes <lannet@lannet.com.au> writes:
> I'm working psql v7.2.2 to postmaster v7.2.2 and want to use the
> \lo_import function.
> The psql manual says that the syntax is \lo_import '<filename>' 'comment'
> This loads the blob OK and returns the loid but the comment gets lost and
> doesn't appear when I run \lo_list

I think the comment-on-LO facility only works if you are superuser
(because it's hacking a system table, there not being any actual
COMMENT ON LARGE OBJECT command).

            regards, tom lane

Re: psql and \lo_import

From
Howard Lowndes
Date:
On Mon, 22 Sep 2003, Tom Lane wrote:

> Howard Lowndes <lannet@lannet.com.au> writes:
> > I'm working psql v7.2.2 to postmaster v7.2.2 and want to use the
> > \lo_import function.
> > The psql manual says that the syntax is \lo_import '<filename>' 'comment'
> > This loads the blob OK and returns the loid but the comment gets lost and
> > doesn't appear when I run \lo_list
>
> I think the comment-on-LO facility only works if you are superuser
> (because it's hacking a system table, there not being any actual
> COMMENT ON LARGE OBJECT command).

I hear what you say, but the psql manual specifically mentions that the
difference between the \lo_import command and the server-side lo_import
function is that the former "acts as the local user on the local file
system, rather than the server's user and file system".  If this is the
case then why do they not specifically mention the superuser restriction
in the syntax.

To my mind this impies that this restriction (to be the superuser) does
not apply to the \lo_import command.

Further, the blob is loaded into pg_largeobject table, which surely, is a
system table.

--
Howard.
LANNet Computing Associates - Your Linux people <http://www.lannetlinux.com>
------------------------------------------
Flatter government, not fatter government - Get rid of the Australian states.
------------------------------------------
If all economists were laid end to end, they would not reach a conclusion
- George Bernard Shaw