object-quoting-strategy
The object-quoting-strategy
attribute is used to control how object names are quoted in the SQL files generated by Liquibase and used in calls to the database. You can specify it as an attribute of the <databaseChangeLog>
tag in your changelog or in individual changesets.
Uses
The database treats unquoted object names in SQL as case-insensitive by default. However, if you prefer to use case-sensitive object names or are using a reserved word like “table” as an object name, you must quote the names.
In Liquibase, there are three possible values for the object-quoting-strategy
attribute:
LEGACY
– The default value. Does not quote objects unless the database specifies that they must be quoted, usually including reserved words and names with hyphens. In PostgreSQL databases, mixed-case names will also be quoted.QUOTE_ALL_OBJECTS
– Every object gets quoted. For example,person
becomes "person".QUOTE_ONLY_RESERVED_WORDS
– The same logic asLEGACY
, but without mixed-case objects in PostgreSQL databases.
Setting the object-quoting-strategy
Attribute

In <databaseChangeLog>
:
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-4.9.xsd"
object-quoting-strategy="QUOTE_ALL_OBJECTS">
In a changeset:
<changeSet author="adrian" id="1" object-quoting-strategy="QUOTE_ALL_OBJECTS">
<createTable schemaName="proschema" tableName="person">
<column name="name" type="varchar(255)"/>
</createTable>
</changeSet>

In <databaseChangeLog>
:
databaseChangeLog:
- object-quoting-strategy: QUOTE_ALL_OBJECTS
- changeSet:
author: adrian
id: 1
changes:
- createTable:
schemaName: proschema
tableName: person
columns:
- column:
name: name
type: varchar(255)
In a changeset:
- changeSet:
author: adrian
id: 1
object-quoting-strategy: QUOTE_ALL_OBJECTS
changes:
- createTable:
schemaName: proschema
tableName: person
columns:
- column:
name: name
type: varchar(255)

In <databaseChangeLog>
:
{
"databaseChangeLog":[
{
"object-quoting-strategy": "QUOTE_ALL_OBJECTS"
},
{
"changeSet": {
"author": "adrian",
"id": "1",
"changes": [
{
"createTable": {
"schemaName": "proschema",
"tableName": "person",
"columns": [
{
"column": {
"name": "name",
"type": "varchar(255)"
}
}
]
}
}
]
}
}
}
In a changeset:
{
"changeSet": {
"author": "adrian",
"id": "1",
"object-quoting-strategy": "QUOTE_ALL_OBJECTS",
"changes": [
{
"createTable": {
"schemaName": "proschema",
"tableName": "person",
"columns": [
{
"column": {
"name": "name",
"type": "varchar(255)"
}
}
]
}
}
]
}
}