|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
INSERT INTO Syntax
This is more of a syntax question, as I've found the solution while typing it out.
Code:
Table "temp.activelist"
Column | Type | Modifiers
-----------+-----------------------+------------------------------
user | character varying(25) | not null
guest | smallint | not null default 0::smallint
time | integer | not null
view | character varying(10) |
boardid | integer |
messageid | integer |
Indexes:
"activelist_time_idx" btree ("time")
Code:
dbname=# INSERT INTO temp.activelist (time,guest,user) VALUES (2,3,4);
ERROR: syntax error at or near "user" at character 42
LINE 1: INSERT INTO temp.activelist (time,guest,user) VALUES (2,3,4...
^
dbname=# INSERT INTO temp.activelist (time,guest,user) VALUES (2,3,'4');
ERROR: syntax error at or near "user" at character 42
LINE 1: INSERT INTO temp.activelist (time,guest,user) VALUES (2,3,'...
^
Code:
dbname=# INSERT INTO temp.activelist ("user",time,guest) VALUES (2, 3,'4');
INSERT 0 1
dbname=# INSERT INTO temp.activelist (time,guest,"user") VALUES (2,3,'4');
INSERT 0 1
dbname=# INSERT INTO temp.activelist ("time","guest","user") VALUES (2,3,4);
INSERT 0 1
The problem occurs when user is not in quotes. Is this a reserved word or is there something else going on? Thanks for your help. vol7ron |
|
#2
|
||||
|
||||
|
user is a key word, find a better name.
__________________
PostgreSQL-manual |
|
#3
|
|||
|
|||
|
I'm installing a forum, so a better name cannot be used.
As you saw in my post, enclosing in quotes will help protect the field, so another name is not necessary. |
![]() |
| Viewing: Dev Shed Forums > Databases > PostgreSQL Help > INSERT INTO Syntax |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|