porton
porton

Reputation: 5803

Using SQL keywords with Yii

I work with Yii 1.1.13.

Is it good to call a table group? (In MySQL GROUP is a keyword, as used in "GROUP BY")

Upvotes: 1

Views: 155

Answers (1)

isJustMe
isJustMe

Reputation: 5470

It's probably a bad idea, while some RDBMS support applying keywords to fields or tables (and accessing them using [] i.e select [group] from tbl ) it doesn't mean you should.

We recently have an issue where we had a field name group in one of our main tables, this was on a DB2 engine and we never had an issue, but then we moved our DataWarehouse to a PostgreSQL's fork named Greenplum and it didn't support a keyword as name for a field, so the DBA's were forced to change the field name in the migration and several services and reports failed until the code was changed. Production supported was impacted and everybody was mad/crazy about this.

It is my recommendation to avoid it, and remember anything that can go wrong, will go wrong

Upvotes: 1

Related Questions