So I’ve actually got two issues with PostgreSQL. I actually use npgsql.NET to create queries, connections, other with PostgreSQL, however I am new to this database software.
First Issue
I got the error:
Npgsql.PostgresException: '42601: syntax error at or near "#"
POSITION: 16'
after using the script:
CREATE TABLE {textBox1.Text} (
user_id serial PRIMARY KEY,
username VARCHAR ( 50 ) UNIQUE NOT NULL,
password VARCHAR ( 50 ) NOT NULL,
email VARCHAR ( 255 ) UNIQUE NOT NULL,
created_on TIMESTAMP NOT NULL,
last_login TIMESTAMP
);
The textbox1.Text
included: Pronner#2223.
Second Issue
When creating a table with the name PRONNER
for example, it shows up as pronner
. What’s wrong with the capitalization system? Or can it possibly be because I’m using pgAdmin 4
so I just see it as lower case there?
I’m quite new to this like I mentioned at the beginning of the issue, and I used to use MySQL
so the syntax is a teensy bit different, but the system is very different.
2
Answers
As documented in the manual the
#
sign is not allowed in a SQL identifier:The lower case names are also documented in the chapter:
The doc says
So if you want to use uppercase and any special character, you must (always) double quote the name: