Unique key with nulls and copying databases across computers

Started by Wim Ceulemansover 27 years ago3 messagesgeneral
Jump to latest
#1Wim Ceulemans
wim.ceulemans@pophost.eunet.be

Hi

I have a few questions:

1. Is there a simple way in postgresql 6.3.2 to implement a unique index on
one
field with null's allowed. So if the field is null it's ok else the value
must be unique?

2. I have copied the contents of a database ( ../data/base/name/* ) from one
computer to another computer. Is this in fact the way to copy databases?
After copying everything works except for example \dt , \di which gives the
following
error:

ERROR: cache lookup for userid 1003 failed

What does this mean?

Regards
Wim Ceulemans
Nice Software Solutions

#2Vadim Mikheev
vadim@krs.ru
In reply to: Wim Ceulemans (#1)
Re: [GENERAL] Unique key with nulls and copying databases across computers

Wim Ceulemans wrote:

Hi

I have a few questions:

1. Is there a simple way in postgresql 6.3.2 to implement a unique index on
one
field with null's allowed. So if the field is null it's ok else the value
must be unique?

This is exactly what postgresql does!
Did you see any problems?

2. I have copied the contents of a database ( ../data/base/name/* ) from one
computer to another computer. Is this in fact the way to copy databases?
After copying everything works except for example \dt , \di which gives the
following
error:

ERROR: cache lookup for userid 1003 failed

What does this mean?

Create user (createuser) with id 1003 in new database.

Vadim

#3Wim Ceulemans
wim.ceulemans@pophost.eunet.be
In reply to: Vadim Mikheev (#2)
Re: [GENERAL] Unique key with nulls and copying databases across computers

Hi

Thanks. The unique key with nulls does indeed work. Apparently postgresql
treats every null value as a separate unique value, great.

The second problem though is more persistant. I have created a user
'tst1003' with userid 1003 in my linux system. After that I used 'create
user tst1003;' in postgresql. But I the same error pops up if I type \dt or
\di

Do you have any other suggestions?

-----Original Message-----
From: Vadim Mikheev <vadim@krs.ru>
To: Wim Ceulemans <wim.ceulemans@pophost.eunet.be>
Cc: pgsql-general@postgreSQL.org <pgsql-general@postgreSQL.org>
Date: Friday, August 14, 1998 4:14 AM
Subject: Re: [GENERAL] Unique key with nulls and copying databases across
computers

Wim Ceulemans wrote:

Hi

I have a few questions:

1. Is there a simple way in postgresql 6.3.2 to implement a unique index

on

one
field with null's allowed. So if the field is null it's ok else the value
must be unique?

This is exactly what postgresql does!
Did you see any problems?

2. I have copied the contents of a database ( ../data/base/name/* ) from

one

computer to another computer. Is this in fact the way to copy databases?
After copying everything works except for example \dt , \di which gives

the

Show quoted text

following
error:

ERROR: cache lookup for userid 1003 failed

What does this mean?

Create user (createuser) with id 1003 in new database.

Vadim