Spring security core and Postgres


I am using Postgres database server. In Postgres creating a table with then name user is not allowed.

One way to solve this is to map the User domain to a table with another name than user.

Domain User example that works with Postgres using the table uuser:

@GrailsCompileStatic
@EqualsAndHashCode(includes='username')
@ToString(includes='username', includeNames=true, includePackage=false)
@SuppressWarnings(['FieldTypeRequired', 'DuplicateStringLiteral', 'GrailsDomainStringPropertyMaxSize', 'DuplicateNumberLiteral', 'DuplicateMapLiteral'])
class User implements Serializable, MultiTenant<User> {
    
    static constraints = {
        username nullable: false, blank: false, maxSize: 64, unique: true
        password nullable: false, blank: false, password: true
        enabled nullable: false
        accountExpired nullable: false
        accountLocked nullable: false
        passwordExpired nullable: false
    }

    static mapping = {
        table 'uuser'
        password column: '`password`'
        sort 'username'
    }

    private static final long serialVersionUID = 1

    String username
    String password
    Boolean enabled = true
    Boolean accountExpired = false
    Boolean accountLocked = false
    Boolean passwordExpired = false

    Set<RoleGroup> getAuthorities() {
        (UserRoleGroup.findAllByUser(this) as List<UserRoleGroup>)*.roleGroup as Set<RoleGroup>
    }
    
}