Skip site navigation (1) Skip section navigation (2)

Bug in char_length() in 7.0?

From: "Frank P(dot) Miles" <fpmi(at)home(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Bug in char_length() in 7.0?
Date: 2000-05-27 04:53:21
Message-ID: 392F54C1.C53946AB@home.com (view raw or flat)
Thread:
Lists: 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

Next:From: Tom LaneDate: 2000-05-27 05:49:55
Subject: Re: [GENERAL] SPI & file locations
Previous:From: Tom LaneDate: 2000-05-27 02:22:46
Subject: Re: SPI & file locations

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group