Questions tagged [quoted-identifier]

Use this tag for questions involving SQL delimited identifiers (quoted identifiers.)

In SQL, a delimited identifier (also referred to as "quoted identifier") is an identifier (name) enclosed in double quotes.

Delimited identifiers are special in two aspects:

• They can contain characters normally not supported in SQL identifiers. (E.g. "!# odd column name".)

• They can be identical to a reserved word. (E.g. "YEAR".)

Two consecutive double quotation marks within a delimited identifier are interpreted as one double quotation mark. (E.g. "12"" vinyl".)

SQL is by default case insensitive. To make an identifier (name) case sensitive it needs to be quoted. "Some_Table", "SOME_TABLE" and "some_table" are different names because they are quoted. The names some_table, SOME_TABLE and Some_Table are identical names because they are not quoted.

The SQL standard defines the double quote " as the quoting character (single quotes: ' are for string literals.) Some DBMS products deviate from the standard and allow alternative quoting characters. Microsoft SQL Server uses square brackets: [Some_Table] and MySQL uses backticks `Some_Table`.

148 questions
0
votes
1 answer

Create/Amend multiple objects (within a sproc) with different QUOTED_IDENTIFIER values

As a development aid, I am writing a stored procedure which creates/amends database objects from one database into another one. (The sproc takes a CSV string of object names, which it splits into individual values using XML, and therefore the…
freefaller
  • 19,368
  • 7
  • 57
  • 87
0
votes
1 answer

ORMLite Java, casing of sequences

I am trying to connect to postgresql with ORMlite from a Java client. the DB gets generated perfectly, but when I try to insert something into a table that is using an autoincrement id I get the following error: org.postgresql.util.PSQLException:…
Nick
  • 19
  • 6
0
votes
1 answer

Postgres: Escape double quote in schema name created by flyway

context: a java app that use flyway to execute db scripts if the schema is empty, connecting via jdbc. Due to some mistake on my part, I forgot to add the app user as the public schema owner. That led flyway to create a schema with the funny name:…
jlb
  • 358
  • 3
  • 15
0
votes
0 answers

One query runs fine but a very similar one does not run at all

I have been using SQL for many years, but I am pretty new to postgresql. I'm using pgAdmin and I'm running the following query just fine. select * from budget_spending where market is not null limit 10 However, this query does NOT run. select…
ASH
  • 20,759
  • 19
  • 87
  • 200
0
votes
0 answers

terminal select statement is not working inside psql DATABASE_URL

my select * from 'Skills' is not working properly. Please refer to pics. did not work in either tables. I do have data inside the tables.
liu duan
  • 61
  • 2
  • 6
0
votes
0 answers

What is the exact way of using where clause in PostgreSQL 12?

I am trying to query a table using where clause in Postgres 12 case 1 SELECT * FROM schema.e_employee_table WHERE FK_EMPLOYEE=100; so when i query the above query i get "FK_EMPLOYEE" column is missing. case2: SELECT * FROM…
0
votes
1 answer

Postgresql: literal table names

I am making an application that needs to construct Postgresql queries that will execute successfully in scenarios when table names are reserved keywords etc. In Sql Server syntax this is achieved by wrapping everything in square brackets [] i.e.…
HelloWorld
  • 418
  • 3
  • 15
0
votes
1 answer

Schema Capitals Causing Mayhem in Pg_Relation_Size

Firstly, thank you for any future help! Onto my issue: I'm trying to get the size of all tables in my Greenplum database - Simple. However, there are quite a few partitioned tables, and I want their total size, not the independent child size. So I'm…
Vinny Pem
  • 57
  • 1
  • 6
0
votes
1 answer

SQL query to PostgeSQL tables

I have a problem. SELECT * FROM posts CROSS JOIN public."postReactions" AS reactions WHERE posts.userId = '423abb9e-a00d-4045-9e88-4a85897f67e4' But the response from DB is like 'ERROR: column posts.userid doesn't exist. LINE 3: WHERE posts.userId…
0
votes
1 answer

What are the the H2 delimiters for Table and Column Names?

I have a legacy DB with column names which have keywords in them - I want to transfer to H2 without having to rename anything. What can I use with SQL syntax to delimit column and table names? SQL Server uses [], MySQL uses ``, Oracle uses "", and…
sproketboy
  • 8,967
  • 18
  • 65
  • 95
0
votes
2 answers

Oracle SQL, column name gives ORA-00911: invalid character

I created a table through a pivot statement, which automatically creates some variable names that start with a number. create table MYTAB as select * from (select x, anno, v, delta from tab_a13_2 where anno in(2017,2018,2019)) pivot(sum(v) as v,…
Giuseppe
  • 518
  • 10
  • 22
0
votes
0 answers

Postgres : Relation does not exist error, Postgres

Hi im trying to create a trigger after insert on the tUser table. I made my trigger function and it connected. Now i get an error saying: column "cnewusername" of relation "tAuditUser" does not exist. Now this is the first value of my tAuditUser…
0
votes
2 answers

Schema.Table in Postgres

In Postgres, when I run any query using only the table name, I receive the error below: ERROR: relation "transactions" does not exist LINE 2: SELECT * FROM TRANSACTIONS ^ SQL state: 42P01 Character: 16 To get around that I…
anhtle
  • 63
  • 9
0
votes
1 answer

QueryParser not parsing sql statement with quoted identifiers other than ansi-quoted

I am using org.teiid.query.parser.QueryParser to parse a SQL string into Query object. It works fine for ansi quoted identifiers (double quotes). However, it is throwing error while parsing the identifiers quoted with square brackets, single quotes…
M S
  • 1
  • 1
0
votes
0 answers

When to use quotation marks in pgAmin sql code

In the following sql statement (using pgAdmin 4): field_1 comes from table_1 field_2 comes from table_2 Why do I need to place field_1 in quotes, but not field_1? Is there a better way to write this query? SELECT "field_1", field_2 FROM table_1…
SimonRH
  • 1,409
  • 2
  • 13
  • 23