Bucketname as "T"

The below query is giving error: {"code":4000,"msg":"Duplicate variable T already in scope."}

select WaTypCd, WaTypCdDscTe from SampleBucket T 
where T.Entity='WATYP' and DKey = 'ABC-123';

It works fine it I use any other alias at place of “T”. Even small “t” works. Is a capital “T” restricted or keyword that we can’t use?

Could you please suggest?

I don’t see any issue. What version of couchbase you are using.

SELECT WaTypCd, WaTypCdDscTe 
FROM default T 
WHERE T.Entity="WATYP" AND DKey = "ABC-123";

We are using 4.5X something. Any index creation etc. may the cause of this issue?
It looks like “T” is reserved keyword.

It is not reserved keyword. Please provide exact version and exact query I will check it out.
If you are using LET variables or aliases in subqueries all needs to be unique

one more update - I just noticed that this same query is working in one bucket but not on other bucket.

Couchbase Version 4.6
Query: select WaTypCd, WaTypCdDscTe from BTest T
where T.Entity=‘WORKCODE’ and FacKey = ‘US’;

Note: This query is not working on BTest whereas working on other buckets on same cluster. BTest does not have primary index and have created around 60 indexes for adhoc queries. Other buckets don’t have indexes but primary.

In that case we need to find the index that caused this issue. run the query with USE INDEX for all the indexes on the bucket.