Weird behavior of 'default user'

From: Leon <leon(at)udmnet(dot)ru>
To: "'pgsql-general(at)hub(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Weird behavior of 'default user'
Date: 1999-07-16 09:45:13
Message-ID: 378EFF29.3987DC6F@udmnet.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello!

Look at this:

------------------
adb=> create table hh (dd char(2) default user, ff int4);
CREATE
adb=> insert into hh (ff) values (5);
INSERT 572034 1
adb=> select * from hh;
dd |ff
----+--
leon| 5
(1 row)
------------------

How can I understand that? Column dd is of type char(2), whereas
'leon' is four characters! Even more, look here:

------------------
adb=> insert into hh values (user, 7);
INSERT 572045 1
adb=> select * from hh;
dd |ff
----+--
leon| 5
le | 7
(2 rows)
------------------

This absolutely beyond my mind. This means that user, being
inserted explicitly, is correctly truncated. If it is inserted
by default, it is wider than column! Seems something very strange
is going on here.

--
Leon.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Leon 1999-07-16 10:59:20 Re: [GENERAL] Weird behavior of 'default user'
Previous Message Vadim Mikheev 1999-07-16 07:35:50 Re: [HACKERS] RE: [GENERAL] Transaction logging