Syntax Error In Generated Alias

8 views
Skip to first unread message

Paul Tiseo

unread,
Mar 6, 2015, 4:42:19 PM3/6/15
to sequ...@googlegroups.com
I have this query:

api.models.operator.find({where: {username: username}, include: [api.models.credential]}).then(function(user){
  console
.log(user);
});


which results in this sql:

SELECT
operator.*, credentials.id AS credentials.id, credentials.operator_id AS credentials.operator_id, credentials.provider AS credentials.provider, credentials.identifier AS credentials.identifier, credentials.tokens AS credentials.tokens, credentials.createdAt AS credentials.createdAt, credentials.updatedAt AS credentials.updatedAt, credentials.deletedAt AS credentials.deletedAt
FROM
(
SELECT
operator.id, operator.party_id, operator.username, operator.email, operator.firstName, operator.lastName, operator.phone, operator.altPhone, operator.altEmail, operator.signedEula, operator.lastLogin, operator.isLocked, operator.createdAt, operator.updatedAt, operator.deletedAt
FROM
operator AS operator
WHERE
(operator.deletedAt IS NULL AND operator.username = 'superadmin') LIMIT 1
) AS operator
LEFT OUTER JOIN credential AS credentials ON
operator.id = credentials.operator_id AND credentials.deletedAt IS NULL;

and postgresql chokes on the aliases generated. The first error would be in the first SELECT due to the `AS credentials.id`. PG doesn't allow periods in its aliases.

Now, I did set quoted identifiers to false in my configuration settings, but then eager loading will always fail, right? Either the setting is pointless (must always be true) or the aliases should always be quoted? Am I missing something?
Reply all
Reply to author
Forward
0 new messages