dbTalk Databases Forums  

[BUGS] Corrupted string length for bit(n) in information schema

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] Corrupted string length for bit(n) in information schema in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Claus Colloseus
 
Posts: n/a

Default [BUGS] Corrupted string length for bit(n) in information schema - 12-04-2003 , 01:31 PM







Your name : Claus Colloseus
Your email address : collos (AT) physik (DOT) tu-berlin.de

System Configuration
---------------------
Architecture : AMD Athlon XP 2000+

Operating System : Windows 2000 V. 5.00.2195

PostgreSQL version : PostgreSQL-7.4

Compiler used : precompiled for Cygwin distribution:
postgresql-7.4-1.tar.bz2 from 23.11.2003


Please enter a FULL description of your problem:
------------------------------------------------

After creating a domain of type bit(n), the length n is given back
with another number from the information schema. The same distended
number shows up f. e. in the SQL script or the Property table
of pgAdmin.

In the tested case, instead of n=10 as input, n=6 was given back.

Furthermore, a check constraint for the domain doesn't show up in
the information_schema.check_constraints table at all.


Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

A test Database was created by pgAdmin III Version 1.0.1 (Oct 14 2003)
for Windows with:

CREATE DATABASE test
WITH ENCODING = 'UNICODE';

The following was executed with psql V. 7.4 in a Cygwin Bash shell:

CREATE DOMAIN public.dom_10bit
AS bit(10)
DEFAULT B'0000000000'
NOT NULL
CHECK ((VALUE = B'0000000000') OR (VALUE = B'0000000001'));

Afterwards, the following queries gave the respective results:

SELECT domain_name, data_type, character_maximum_length, character_octet_length,
domain_default, udt_name, dtd_identifier
FROM information_schema.domains
WHERE domain_name = 'dom_10bit';

domain_name | data_type | character_maximum_length | character_octet_length | domain_default | udt_name | dtd_identifier
-------------+-----------+--------------------------+------------------------+----------------------+----------+----------------
dom_10bit | bit | 6 | | B'0000000000'::"bit" | bit | 1
(1 row)

SELECT *
FROM information_schema.check_constraints;

constraint_catalog | constraint_schema | constraint_name | check_clause
--------------------+-------------------+-----------------+--------------
(0 rows)

SELECT typname, typlen, typtype, typtypmod, typdefaultbin
FROM pg_type
WHERE typname = 'dom_10bit';

typname | typlen | typtype | typtypmod | typdefaultbin
-----------+--------+---------+-----------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
dom_10bit | -1 | d | 10 | {FUNCEXPR :funcid 1685 :funcresulttype 1560 :funcretset false :funcformat 2 :args ({CONST :consttype 1560 :constlen -1 :constbyval false :constisnull false :constvalue 10 [ 10 0 0 0 10 0 0 0 0 0 ]} {CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ 10 0 0 0 ]} {CONST :consttype 16 :constlen 1 :constbyval true :constisnull false :constvalue 1 [ 0 0 0 0 ]})}
(1 row)

SELECT conname, contype, conbin, consrc
FROM pg_type t INNER JOIN pg_constraint c
ON t.oid = c.contypid
WHERE typname = 'dom_10bit';

conname | contype | conbin | consrc
---------+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------
$1 | c | {BOOLEXPR :boolop or :args ({OPEXPR pno 1784 pfuncid 0 presulttype 16 pretset false :args ({COERCETODOMAINVALUE :typeId 1560 :typeMod 10} {CONST :consttype 1560 :constlen -1 :constbyval false :constisnull false :constvalue 10 [ 10 0 0 0 10 0 0 0 0 0 ]})} {OPEXPR pno 1784 pfuncid 0 presulttype 16 pretset false :args ({COERCETODOMAINVALUE :typeId 1560 :typeMod 10} {CONST :consttype 1560 :constlen -1 :constbyval false :constisnull false :constvalue 10 [ 10 0 0 0 10 0 0 0 0 64 ]})})} | ((VALUE = B'0000000000'::"bit") OR (VALUE = B'0000000001'::"bit"))
(1 row)

pgAdmin3 now shows the following script (notice the double 'CHECK'):

CREATE DOMAIN public.dom_10bit
AS bit(6)
DEFAULT B'0000000000'::"bit"
NOT NULL
CHECK CHECK ((VALUE = B'0000000000'::"bit") OR (VALUE = B'0000000001'::"bit"));

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

well, no, i'm a newbie to PostgreSQL

Sincerely,
Claus Colloseus

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Reply With Quote
  #2  
Old   
Peter Eisentraut
 
Posts: n/a

Default Re: [BUGS] Corrupted string length for bit(n) in information schema - 12-07-2003 , 04:36 AM






Claus Colloseus wrote:
Quote:
After creating a domain of type bit(n), the length n is given back
with another number from the information schema.
Will be fixed in 7.4.1.


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.