From: | Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> |
---|---|
To: | jonathan sepulveda <jonathanspb(at)yahoo(dot)com> |
Cc: | pgsql-es-ayuda(at)postgresql(dot)org |
Subject: | Re: Php y postgres |
Date: | 2004-09-28 13:43:56 |
Message-ID: | 20040928134356.GB6676@dcc.uchile.cl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
On Tue, Sep 28, 2004 at 08:34:27AM -0500, jonathan sepulveda wrote:
> Tengo problemas para crear una base de datos con php,
> al pasarle algun numero me dice:
>
> Creando la Bade de Datos
>
> Warning: pg_query() [function.pg-query]: Query failed:
> ERROR: syntax error at or near "187" at character 17
> in /usr/local/apache/htdocs/cempresa.php on line 22
> No se Pudo Crear la Base de Datos ERROR: syntax error
> at or near "187" at character 17
En general no puedes usar identificadores que empiecen con numeros. Si
quieres hacerlo, usa comillas dobles para delimitarlos.
alvherre=# create table 1 (a int);
ERROR: error de sintaxis en o cerca de «1» en el carácter 14
LINE 1: create table 1 (a int);
^
alvherre=# create table "1" (a int);
CREATE TABLE
Claro que si estas usando pg_query tendras que escapar las comillas
dobles,
pg_query("create table \"1\" (a int)");
Yo te aconsejo simplemente empezar con una letra para ahorrarte lios.
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Doing what he did amounts to sticking his fingers under the hood of the
implementation; if he gets his fingers burnt, it's his problem." (Tom Lane)
From | Date | Subject | |
---|---|---|---|
Next Message | jonathan sepulveda | 2004-09-28 13:48:39 | Re: Php y postgres |
Previous Message | Ysrael Guzmán | 2004-09-28 13:36:42 | Re: Php y postgres |