Обсуждение: BUG #4412: Check constraints cannot be added to the table for fields that are mixed case
The following bug has been logged online: Bug reference: 4412 Logged by: Kevin Email address: kevin@rtvision.com PostgreSQL version: 8.0.15 Operating system: Gentoo Linux Description: Check constraints cannot be added to the table for fields that are mixed case Details: Check constraints cannot be added to the table for fields that are mixed case. Example - field employeeName in table Employees --------- ALTER TABLE "Employees" ADD CONSTRAINT "employeeNameTest" CHECK (employeeName != 'Kevin') ---- results in --- ERROR: column "employeename" does not exist --------- I'm new to postgreSql, and using phppgadmin (also tried this with psql), so haven't tried putting check directly on the field/column instead of the table. Also, the constraint I'm really trying to write requires referencing 2 columns. For now, I switched the field names (to employee_name for example).
Re: BUG #4412: Check constraints cannot be added to the table for fields that are mixed case
От
"Jaime Casanova"
Дата:
On Tue, Sep 9, 2008 at 3:11 PM, Kevin <kevin@rtvision.com> wrote: > Description: Check constraints cannot be added to the table for > fields that are mixed case > Details: > > Check constraints cannot be added to the table for fields that are mixed > case. > > Example - field employeeName in table Employees postgres converts all your uppercase in object names to lowercase... if you really want mixed case you must put the name in quotes. Try with: ALTER TABLE "Employees" ADD CONSTRAINT employeenametest CHECK (employeename !=3D 'Kevin') --=20 regards, Jaime Casanova Soporte y capacitaci=F3n de PostgreSQL Asesor=EDa y desarrollo de sistemas Guayaquil - Ecuador Cel. (593) 87171157
Re: BUG #4412: Check constraints cannot be added to the table for fields that are mixed case
От
Stephan Szabo
Дата:
On Tue, 9 Sep 2008, Kevin wrote:
> The following bug has been logged online:
>
> Bug reference: 4412
> Logged by: Kevin
> Email address: kevin@rtvision.com
> PostgreSQL version: 8.0.15
> Operating system: Gentoo Linux
> Description: Check constraints cannot be added to the table for
> fields that are mixed case
> Details:
>
> Check constraints cannot be added to the table for fields that are mixed
> case.
>
> Example - field employeeName in table Employees
> ---------
> ALTER TABLE "Employees" ADD CONSTRAINT "employeeNameTest" CHECK
> (employeeName != 'Kevin')
I don't have 8.0 around to test, but I think that should be
("employeeName" != 'Kevin'). If you created the table with mixed-case
columns in double quotes or used a tool which double quoted them for you,
then you must double quote the column name when it's referenced, otherwise
the names are case-folded.