0
votes

I am executing a simple select query on my trial instance of snowflake. select * from schema_migrations;

I am getting the following error: SQL compilation error: Object 'SCHEMA_MIGRATIONS' does not exist or not authorized.

The correct role, database and schema have been selected in the top right corner of the query box. Attaching a screenshot.

The same select query is working for a different table in the same db, schema.

Note that this table (schema_migrations) was created via golang code using snowflake library for golang.

1

1 Answers

2
votes

Snowflake's object identifiers are case-sensitive. Your table created from Go has been created with a double-quoted table name identifier, and thus appears as lower-case in your screenshot.

Therefore, to query it, you must explicitly specify a lower-case name:

SELECT * FROM UTIL_DB.PUBLIC."schema_migrations";

Unquoted identifier names are treated as upper-case and will not match identifiers that were double-quoted. Quoting the relevant documentation portions that speak of this:

When an identifier is unquoted, it is stored and resolved in uppercase.

When an identifier is double-quoted, it is stored and resolved exactly as entered, including case.

And,

If an object is created using a double-quoted identifier, when referenced in a query or any other SQL statement, the identifier must be specified exactly as created, including the double quotes.

Failure to include the quotes might result in an Object does not exist error (or similar type of error).