yuqi1129 opened a new issue, #14502:
URL: https://github.com/apache/gravitino/issues/14502

   ### Version
   
   main branch, source checked at 90da2776a. PostgreSQL catalog.
   
   ### Describe what's wrong
   
   Two request/source errors are classified as service failures:
   
   1. SQLSTATE `42501` (insufficient_privilege) becomes a generic runtime 
exception instead of a permission refusal. An unqualified table create in an 
existing schema without USAGE can instead produce `3F000` and be reported as a 
missing schema (404).
   2. A NUL (U+0000) in a table comment, column comment or string default 
reaches DDL generation. A source protocol refusal such as `08P01` is then 
mapped to a connection failure (502), even though the request text is invalid.
   
   These belong to one PostgreSQL error-classification/input-validation change. 
Permission refusals should preserve their meaning as 403; invalid NUL text 
should be rejected as 400 before DDL. Real missing-schema and connection 
failures must retain their existing classifications.
   
   ### Error message and/or stacktrace
   
   - `permission denied for schema existing_schema` (`42501`) -> generic 
runtime error/500.
   - `no schema has been selected to create in` (`3F000`) -> missing schema/404 
when the role lacks USAGE on a schema that exists.
   - `insufficient data left in message` (`08P01`) -> 
ConnectionFailedException/502 when user text contains NUL.
   
   ### How to reproduce
   
   For permissions:
   1. Create a test schema owned by another PostgreSQL role and configure a 
catalog with a least-privilege source login.
   2. Attempt a table create without USAGE on the schema. Compare the error 
with the native schema-qualified create.
   3. Grant USAGE but no CREATE and repeat. Expect a permission error rather 
than missing-schema or internal-error responses.
   
   For NUL text:
   1. Send a REST table-create request with an actual U+0000 in a table/column 
comment or string default, using the JSON escape `\u0000`.
   2. Repeat with table/column comment and default-value alters.
   3. Expect a field-specific input error before any DDL. A multi-change alter 
containing invalid text must apply none of its changes.
   
   ### Additional context
   
   Source inspection and focused converter diagnostics on main confirm the 
`42501` and `08P01` classifications. The scope includes normal 
connection/missing-object controls and live PostgreSQL privilege tests. Do not 
globally reclassify every `08P01` as a client error: genuine protocol failures 
remain connection failures; NUL validation belongs at the PostgreSQL input 
boundary.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to