On Jun 30, 3:23 pm, Lukas Eder <[email protected]> wrote: > > I think there are some difficulties too when it comes to type casting. > > A "selectFrom(Cities.CITIES)" will return some CitiesRecords that are > > in fact CapitalsRecords. > > But when you select from CITIES, then you will actually only get the > cities records. Even if some records are in fact capitals, their known > type is only Cities, I think?
Correct. > pg_class.relname is probably the correct way to do this. But again, > why do you think we'd need the cast to CapitalsRecord? After all, what > is selected here is a CitiesRecord. And city.store() would correctly > store the "city-part" of a capital, if it is a capital... Strictly speaking, you're (again ;)) right of course. But i can imagine situations where you're iterating over cities records and want to do something "capitals specific", for instance, show the state, when a record is a capital. Maybe this is the user's problem: he could just request the full capitals record using the specific record's primary key when needed. But there still needs to be a way to find out which cities records are capitalsrecords..
