pg_column_size strange result...

From: marin(at)kset(dot)org
To: pgsql-general(at)postgresql(dot)org
Subject: pg_column_size strange result...
Date: 2017-08-16 09:51:09
Message-ID: c18b69cebf329780687ad633977c2710@kset.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I was calculating row sizes with pg_column_size and came to this strange
result:

CREATE TABLE t1(
c1 NUMERIC(10,7) NOT NULL DEFAULT 123.1234567
);

INSERT INTO t1(c1) VALUES (DEFAULT);

SELECT pg_column_size(c1) AS first,
pg_column_size(123.1234567::NUMERIC(10,7)) as second, c1 =
123.1234567::NUMERIC(10,7) AS are_equal
FROM t1;

+-------+--------+-----------+
| first | second | are_equal |
+-------+--------+-----------+
| 9 | 12 | t |
+-------+--------+-----------+

Is there a reason pg_column_size returns different sizes for a constant
and the same value from a table column?

Regards,
Mladen Marinović

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alex Samad 2017-08-16 10:46:31 Re: Begginers question
Previous Message Michael Paquier 2017-08-16 06:16:51 Re: Begginers question