pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: create large object by tcl
3+ messages / 2 participants
[nested] [flat]

* Re: create large object by tcl
@ 2004-02-21 16:51 L J Bayuk <ljb220@mindspring.com>
  2004-02-22 14:12 ` Re: create large object by tcl =?big5?q?Wong=20Eric?= <hehe88hk@yahoo.com.hk>
  0 siblings, 1 reply; 3+ messages in thread

From: L J Bayuk @ 2004-02-21 16:51 UTC (permalink / raw)
  To: hehe88hk@yahoo.com.hk; +Cc: pgsql-interfaces

hehe88hk@yahoo.com.hk wrote:
> ...
> If I use the libpgtcl library, I find it can only get a file
> descriptor of '-1' returned by pg_lo_open.
>
> If I use pgintcl, I find it can only get a file descriptor of '0'
> returned by pg_lo_open, followed by an error message:
> 
> "
> ERROR:  lo_write: invalid large obj descriptor (0)
> ...

Are you doing all your large object calls inside transaction blocks,
as required? If not, the large object descriptors will not be valid.
Send BEGIN, operate on a large object, then send COMMIT.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: create large object by tcl
  2004-02-21 16:51 Re: create large object by tcl L J Bayuk <ljb220@mindspring.com>
@ 2004-02-22 14:12 ` =?big5?q?Wong=20Eric?= <hehe88hk@yahoo.com.hk>
  2004-02-23 01:09   ` Re: create large object by tcl L J Bayuk <ljb220@mindspring.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Wong Eric @ 2004-02-22 14:12 UTC (permalink / raw)
  To: L J Bayuk <ljb220@mindspring.com>; +Cc: pgsql-interfaces

Thanks for your help and I can create and write to
large object by Tcl successfully.

(I find that the documentation has mentioned about
this and I overlooked it)

However, I would like to ask why a transaction is
needed for accessing large object?


 --- L J Bayuk <ljb220@mindspring.com> ªº¶l¥ó¤º®e¡G>
hehe88hk@yahoo.com.hk wrote:
> > ...
> > If I use the libpgtcl library, I find it can only
> get a file
> > descriptor of '-1' returned by pg_lo_open.
> >
> > If I use pgintcl, I find it can only get a file
> descriptor of '0'
> > returned by pg_lo_open, followed by an error
> message:
> > 
> > "
> > ERROR:  lo_write: invalid large obj descriptor (0)
> > ...
> 
> Are you doing all your large object calls inside
> transaction blocks,
> as required? If not, the large object descriptors
> will not be valid.
> Send BEGIN, operate on a large object, then send
COMMIT. 

_________________________________________________________
¥²±þ§Þ¡B¶¼ºq¡B¤p¬P¬P...
®öº©¹aÁn  ±¡¤ß³sô
http://us.rd.yahoo.com/evt=22281/*http://ringtone.yahoo.com.hk/



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: create large object by tcl
  2004-02-21 16:51 Re: create large object by tcl L J Bayuk <ljb220@mindspring.com>
  2004-02-22 14:12 ` Re: create large object by tcl =?big5?q?Wong=20Eric?= <hehe88hk@yahoo.com.hk>
@ 2004-02-23 01:09   ` L J Bayuk <ljb220@mindspring.com>
  0 siblings, 0 replies; 3+ messages in thread

From: L J Bayuk @ 2004-02-23 01:09 UTC (permalink / raw)
  To: hehe88hk@yahoo.com.hk; +Cc: pgsql-interfaces

> However, I would like to ask why a transaction is
> needed for accessing large object?

Here's how I understand it. If I get it badly wrong, perhaps someone
else will step in and correct me.

The PostgreSQL database server creates a context in which to store
information it needs to process commands.  If you don't start a transaction
block with BEGIN, a new context is created for each command, and destroyed
after the command is processed.  If you use BEGIN to start a transaction
block, the context stays around until you use COMMIT or ROLLBACK to end the
transaction block.

Large object file descriptors, like cursors, are stored in this context.
So if you open a large object outside a transaction block, the large object
file descriptor you get back is invalid, because the context it was created
in was already destroyed.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2004-02-23 01:09 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-02-21 16:51 Re: create large object by tcl L J Bayuk <ljb220@mindspring.com>
2004-02-22 14:12 ` =?big5?q?Wong=20Eric?= <hehe88hk@yahoo.com.hk>
2004-02-23 01:09   ` L J Bayuk <ljb220@mindspring.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox