Default values not working

Started by Bryan Whitealmost 27 years ago3 messagesgeneral
Jump to latest
#1Bryan White
bryan@arcamax.com

If I add a field to a colum using:
alter table mytable add column myint int not null default 0;
The default value does not seem to make it into the data dictionary.

This is using Postgres 6.5.

Is there is way to manually poke a default value into the data dictionary?

Bryan White
ArcaMax Inc.
Yorktown VA
www.arcamax.com

#2Lauri Posti
lauri@peak.edu.ee
In reply to: Bryan White (#1)
large objects

Hi!

I've been trying to get postgres LO interface to work with python.

I have been successful with three configurations:
1) pgsql 6.4.2 & PyGreSQL 2.2 on Linux/x86
2) pgsql 6.5beta1 & PyGgeSQL 2.3 on Linux/x86
3) pgsql 6.5beta1 & PyGreSQL 2.3 on SPARC/Solaris 2.6

And failed with all other:
* 6.5beta2 ... 6.5 final on SPARC/Solaris 2.6 and Linux/x86 with PyGreSQL
2.3 & 2.4 in any combination.

* 6.4.2 on SPARC/Solaris 2.6 with PyGreSQL 2.2 .. 2.4

What i rally need is to get something to work on SPARC/Solaris. The only
vesrion taht has worked is 6.5beta1 but I can't find it anywhere.

with 6.4.2 & PyGreSQL on Solaris (on x86 linus it is ok) the problem is
following:
$python
Python 1.5.2 (#5, Jun 30 1999, 20:15:59) [GCC egcs-2.91.66 19990314
(egcs-1.1.2 on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam

from pg import *
c=connect()
o=c.locreate(INV_WRITE)
o.open(INV_WRITE)
o.oid

21089

o.close()
o2=c.locreate(INV_WRITE)
o2.open(INV_WRITE)

o2.write("hello")
o2.close()

Traceback (innermost last):
File "<stdin>", line 1, in ?
IOError: error while closing large object fd.

and 6.5 on both Solaris $ Linux the problem is folllowing:
[postgres@liha pgsql]$ python
Python 1.5.2 (#3, Jun 13 1999, 23:57:46) [GCC egcs-2.91.66 19990314/Linux
(egcs- on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam

from pg import *
con=connect("testdb","",5432,"","","koll","koll")
lo=con.locreate(INV_WRITE)
lo.oid

18593

lo.open(INV_WRITE)

Traceback (innermost last):
File "<stdin>", line 1, in ?
IOError: can't open large object.

and backend says:
ERROR: lo_lseek: invalid large obj descriptor (0)

Any ideas?

Thanks in advance,
Lauri

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Lauri Posti (#2)
Re: [INTERFACES] large objects

Lauri Posti <lauri@peak.edu.ee> writes:

I've been trying to get postgres LO interface to work with python.

I think you need begin/end transaction around lo_open ... lo_close
sequence.

regards, tom lane