alter table bug???

Started by Terry Mackintoshabout 27 years ago2 messages
#1Terry Mackintosh
terry@terrym.com

Hi all

6.4 release version on RedHat 4.2 w/ many upgrades including flex.

Check this out, the 'password' field was an after thought, and was added
using the alter table command:
Also, I found a spelling error in a field name, so ran these two commands
in this order:

alter table listings rename lanme to lname;

alter table listings add column password char(10);

All seemed fine untill the project got to the point where password came
into use:

lse=> \d listings

Table    = listings
+------------------------+----------------------------------+-------+
|         Field          |              Type                | Length|
+------------------------+----------------------------------+-------+
| title                  | char() not null                  |    30 |
| discription            | char() not null                  |   150 |
| url                    | char() not null                  |   100 |
| lname                  | char() not null                  |    20 |
| fname                  | char() not null                  |    20 |
| email                  | char() not null                  |   100 |
| ent_date               | datetime not null default dateti |     8 |
| mod_date               | datetime not null default dateti |     8 |
| approved               | bool not null default 'False'    |     1 |
| item_id                | int4 not null default nextval (  |     4 |
| password               | char()                           |    10 |
+------------------------+----------------------------------+-------+
Indices:  listings_pkey
          listings_url_key
lse=> select * from listings where password = '093b7a6b';
ERROR:  RestrictionClauseSelectivity: bad value 2.164003
lse=> select password from listings where item_id = 1;
password
----------
093b7a6b
(1 row)

lse=>

Any ideas what that is all about?

Thanks, have a great day
Terry Mackintosh <terry@terrym.com> http://www.terrym.com
sysadmin/owner Please! No MIME encoded or HTML mail, unless needed.

Proudly powered by R H Linux 4.2, Apache 1.3, PHP 3, PostgreSQL 6.4
-------------------------------------------------------------------
Success Is A Choice ... book by Rick Patino, get it, read it!

#2Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Terry Mackintosh (#1)
Re: [HACKERS] alter table bug???

Indices: listings_pkey
listings_url_key
lse=> select * from listings where password = '093b7a6b';
ERROR: RestrictionClauseSelectivity: bad value 2.164003
lse=> select password from listings where item_id = 1;
password
----------
093b7a6b
(1 row)

lse=>

Any ideas what that is all about?

VACUUM ANALYZE the table and see if that fixes it.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026