error creating table for postgres

Ralph DiMola rdimola at evergreeninfo.net
Mon Apr 22 00:50:35 EDT 2013


I put brackets[] around table and field names to avoid this. I would have
written it like this. This convention also has the advantage of being more
readable.

CREATE TABLE [plumber_joe_the__001_sofa]  (uniq_[sfky] INTEGER PRIMARY KEY ,
[subq] CHAR(3) , [a] TEXT, [b] TEXT, [c] TEXT, [d] TEXT, [ordr] INTEGER,
[user] CHAR(20), [tstmp] TIMESTAMP WITH TIMEZONE )

Ralph DiMola
IT Director
Evergreen Information Services
rdimola at evergreeninfo.net


-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf
Of Igor de Oliveira Couto
Sent: Monday, April 22, 2013 12:18 AM
To: How to use LiveCode
Subject: Re: error creating table for postgres

On 22/04/2013, at 10:54 AM, Dr. Hawkins <dochawk at gmail.com> wrote:

> I think the following had been working for some time, but now it 
> creates an
> error:
> 
> CREATE TABLE plumber_joe_the__001_sofa  (uniq_sfky INTEGER PRIMARY KEY 
> , subq CHAR(3) , a TEXT, b TEXT, c TEXT, d TEXT, ordr INTEGER, user 
> CHAR(20), tstmp TIMESTAMP WITH TIMEZONE ) produces
> 
> Error:  syntax error at or near "user" at character 135

AFAIK, "USER" is a reserved word in SQL - since SQL-92:

http://developer.mimer.com/validator/sql-reserved-words.tml

There are some online SQL validators which you may find useful, if you run
into issues like this. The site above has 3 validators, which validate your
syntax against the SQL standard, rather than trying to validate it against
syntax specific to a certain product - ie., MySQL, PostgreSQL, or SQLite.
The address for the validators are:

SQL-92:
http://developer.mimer.com/validator/parser92/index.tml

SQL-99:
http://developer.mimer.com/validator/parser99/index.tml

SQL-2003:
http://developer.mimer.com/validator/parser200x/index.tml

I hope this helps!

--
Igor Couto
Sydney, Australia





_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list