Re: bug in Auth (?)
| From: | Brian Abent | Date: | Fri, 11 Apr 2003 14:45:44 +0000 |
| Subject: | Re: bug in Auth (?) | ||
| References: | 1 | Groups: | php.pear.dev php.pear.general |
| Request: | Send a blank email to pear-dev+get-15117@lists.php.net to get a copy of this message | ||
From postgresql FAQ:
4.14) What is the difference between the various character types?
Type Internal Name Notes--------------------------------------------------
VARCHAR(n) varchar size specifies maximum length, no padding CHAR(n) bpchar blank padded to the specified fixed length TEXT text no specific upper limit on length BYTEA bytea variable-length byte array (null-byte safe) "char" char one characterYou will see the internal name when examining system catalogs and in some error messages. The first four types above are "varlena" types (i.e., the first four bytes on disk are the length, followed by the data). Thus the actual space used is slightly greater than the declared size. However, these data types are also subject to compression or being stored out-of-line by TOAST, so the space on disk might also be less than expected. VARCHAR(n) is best when storing variable-length strings and it limits how long a string can be. TEXT is for strings of unlimited length, with a maximum of one gigabyte. CHAR(n) is for storing strings that are all the same length. CHAR(n) pads with blanks to the specified length, while VARCHAR(n) only stores the characters supplied. BYTEA is for storing binary data, particularly values that include NULL bytes. All the types described here have similar performance characteristics. http://www.postgresql.org/docs/faqs/FAQ.html HTH -brian At 03:44 PM 4/11/2003 +0200, Jeroen Houben wrote:
Hi Martin, I'm switching from MySql to PostgreSQL and PEAR::Auth keeps throwing "wrong username and password" at me. After some investigation I found out that postgres returns extra spaces in char fields, the results aren't trimmed. I changed the source for Container/DB.php on line 217 like this:if (is_array($entry)) { if ($this->verifyPassword(trim($password),trim($entry[$this->options['passwordcol']]),$this->options['cryptType'])) { $res->free();That works. Can you apply this patch, or should I (as the user) just make sure my database returns trimmed results? TIA Jeroen btw is something wrong at php.net, I don't seem to be receiving any mail on the PEAR mailinglists.. -- PEAR Development Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php