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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Una de comparaciones


  • From: "Miguel Rodríguez Penabad" <penabad(at)gmail(dot)com>
  • To: "Lista Postgres ES" <pgsql-es-ayuda(at)postgresql(dot)org>
  • Subject: Re: Una de comparaciones
  • Date: Thu, 31 Jan 2008 01:32:08 +0100
  • Message-id: <95335e4e0801301632v6eb61f1ft316a06aae2ed111a(at)mail(dot)gmail(dot)com>

> > resumiendo ¿hay algun parametro o algo parecido que haga que select
> > 'A'='A   ' devuelva true ?

Además, depende del tipo de dato que uses.
Mira este ejemplillo. Parece que usando char(n) hace lo que tú quieres

Miguel=> create table xa(a text, b varchar(10), c char(10));
CREATE TABLE
Miguel=> insert into xa values('a ','b ', 'c ');
INSERT 0 1
Miguel=> select  * from xa;
 a  | b  |     c
----+----+------------
 a  | b  | c
(1 row)

Miguel=> select a||b||c||'.' from xa;
 ?column?
----------
 a b c.
(1 row)

Miguel=> update xa set c='X     ';
UPDATE 1
Miguel=> select a||b||c||'.' from xa;
 ?column?
----------
 a b X.
(1 row)

Miguel=> select * from xa where c='X';
 a  | b  |     c
----+----+------------
 a  | b  | X
(1 row)

No sé si es un error de postgres, pero en todo caso me parece
"peligroso" confiar en que siempre funcione así. Mejor usa trim() como
te han dicho otros compañeros
-- 
Miguel Rodríguez Penabad



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group