I have a question about this fiddle:
I cannot see why the records from the json data set will not be added to the table SAMPLE. It is a bit baffling to me right now. Even when I manually add an INSERT INTO ... command the data still does not show up after running SELECT * .....
`SAMPLE` is a different table from `"SAMPLE"`. PostgreSQL lower-cases unquoted table names to conform (its interpretation of) to the SQL standard.
You can read at length my own troubles with this behaviour on [this thread]. The TL;DR: of it though is:
1. The SQL Standard requires identifiers to match regardless of casing
2. Different platforms have different interpretations of this. If I recall correctly...
- SQL Server: `MyTable` = `mytable`, by default you cannot create both
- Oracle: all unquoted identifiers get **UPPERCASED**
- MySQL & PostgreSQL: all unquoted identifiers get **lowercased**
3. If you _always_ quote-wrap your identifier, every platform will respect your given casing. If not, you have to be sensitive to each platform's quirks
The most direct citation from the (2011) SQL standard is (I believe) found in **IWD 9075-2:201?(E), 5.4 Names and identifiers** under **Syntax Rules**
> 2) An <SQL language identifier> is equivalent to an <SQL language identifier> in which every letter that is
a lower-case letter is replaced by the corresponding upper-case letter or letters...
Sadly, I cannot find a freely available complete PDF of the 2011 standard at this time, but you can spelunk further yourself a the following links if the spirit moves you