Closed Davincible closed 1 year ago
Another issue for the same query, the star expansion does not seem to work here properly unfortunately. The following query gets generated:
SELECT
"Monitor"."ID",
"UserRecordsU"."Username"
FROM
"Monitor"
JOIN ( SELECT DISTINCT ON ("User")
ID, "User", CreatedAt, Username, FullName, Biography, FollowingCount, FollowerCount, IsBusiness, IsPrivate, IsVerified, HasVideos, Category, ClipsCount, IsPotentialBusiness, HasHighlightReels, MediaCount, HasGuides, GeoMediaCount, CTAEnabled, FollowingTagCount, BiographyEntities, BiographyProductMentions, ExternalUrl, IGTVVideos, HasIGTVSeries, ProfilePicture, AREffects, UsertagsCount, ShowShoppableFeed, ShoppablePosts, CanBeReported, MerchantChecoutStyle, SellerShoppableFeedType, VisibleProducts, HasAffiliateShop, CreatorShoppingInfo, IsEligibleForSMBSupportFlow, SMBSupportPartner, DirectMessaging, AddressStreet, BusinessContactMethod, CityID, CityName, ContactPhoneNumber, Latitude, Longitude, PublicEmail, PublicPhoneCountryCode, PublicPhoneNumber, Zip, SuggestedBusinessAccType, AccountType, FundraiserInfo, AccountBadges, IncludeDirectBlacklistStatus
FROM
"UserRecords"
ORDER BY
"User",
"CreatedAt" DESC) "UserRecordsU" ON "Monitor"."ID" = "UserRecordsU"."User"
WHERE
"Monitor"."Monitor" = TRUE
And here only the User
column gets quoted, where all columns should be quoted. Normally that works perfectly, but for this one query it seems to break.
@Davincible Could you please provide the schema for the Monitor and User tables?
Version
1.12.0
What happened?
Gives column is ambiguous. This happens because I have a table called "UserRecords", as well as called the
JOIN
table "UserRecords". However the SQL is not actually ambiguous and executes fine, sqlc confuses the two when there is no reason to. Renaming theJOIN
table mitigates it for now.Relevant log output
No response
Database schema
No response
SQL queries
No response
Configuration
No response
Playground URL
No response
What operating system are you using?
No response
What database engines are you using?
No response
What type of code are you generating?
No response