I am unable to specify column names that have spaces (an possibly other things) in a fetch statement. I do have a workaround, and that is to literally quote the column name in the args.
In the following example (yes, I know it just returns a bunch of nulls, if it worked), the generated API call fails when column contains a space.
const {data, error} = await supabase
.from(table_name)
.select(column)
.is(column, null);
For example, assuming the database had a table named "My Table" with a nullable column named "My Column", and the query specified table_name = "My Table" and column = "My Column", the resulting REST query is
https://xxxxxx.supabase.co/rest/v1/My%20Table?select=MyColumn&My+Column=is.null
The table name is correctly interpreted as case-sensitive with spaces, however, for the returned data, the column name is stripped of its space and it returns a 400 Bad Request HTTP error.
The error is:
{
"code": "42703",
"details": null,
"hint": 'Perhaps you meant to reference the column "My Table.My Column".',
"message": "column My Table.MyColumn does not exist"
}
I did not find in the API documentation where this behavior is specified.
I am unable to specify column names that have spaces (an possibly other things) in a fetch statement. I do have a workaround, and that is to literally quote the column name in the args.
In the following example (yes, I know it just returns a bunch of nulls, if it worked), the generated API call fails when
columncontains a space.For example, assuming the database had a table named "My Table" with a nullable column named "My Column", and the query specified table_name = "My Table" and column = "My Column", the resulting REST query is
The table name is correctly interpreted as case-sensitive with spaces, however, for the returned data, the column name is stripped of its space and it returns a 400 Bad Request HTTP error.
The error is:
I did not find in the API documentation where this behavior is specified.