Bug in char_length() in 7.0? - Mailing list pgsql-general

From Frank P. Miles
Subject Bug in char_length() in 7.0?
Date
Msg-id 392F54C1.C53946AB@home.com
Whole thread Raw
List pgsql-general
char_length() no longer seems to be working for me (at least with my
current build).

For example, create a simple test table and populate it with some
values:

CREATE TABLE test (
        f1              character(4)    NOT NULL,
        f2              varchar(20),
PRIMARY KEY (f1)
);

INSERT INTO test VALUES ('a', 'field a');
INSERT INTO test VALUES ('b', 'field b');
INSERT INTO test VALUES ('cc', 'field c');
INSERT INTO test VALUES ('dd', 'field d');
INSERT INTO test VALUES ('eee', 'field e');
INSERT INTO test VALUES ('fff', 'field f');
INSERT INTO test VALUES ('gggg', 'field g');
INSERT INTO test VALUES ('hhhh', 'field h');

Now use the selection:

SELECT * FROM test WHERE char_length(f1) = 2;

No results are returned.  If the selection:

SELECT * FROM test WHERE char_length(f1) = 4;

is used, *all rows* are returned.  Has the definition
of char_length been changed since 6.5.x?  Is there
some other function to take its place?

Thanks...
    -frank

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: SPI & file locations
Next
From: "planx plnetx"
Date:
Subject: where find postgres7.0 RPMs?