Skip to content
AI Agent + Supabase...
 
Notifications
Clear all

AI Agent + Supabase Tool Connector: Handling Null Values in SQL Inserts

4 Posts
2 Users
0 Reactions
8 Views
Dendan
(@dendan)
Posts: 2
New Member
Topic starter
 

Hello everyone,

I'm currently working with ChatGPT 4.1 and the Tool Connector to input data into a structured SQL table within Supabase (not a vector table). The agent's role is to parse user input and extract two essential fields:

  • amount (integer)
  • next_date_to_pay (timestamp/date in ISO format)

Following extraction, it invokes a tool to insert these values into the table. The table schema has NOT NULL constraints for both of these fields.

Despite the agent appearing to extract both values accurately, the tool invocation frequently fails with the following error:
Bad request - please check your parameters: null value in column "amount" of relation "test_table_for_savings" violates not-null constraint

This situation appears to be a common workflow: extract → validate → insert into SQL. Has anyone else encountered similar problems, or successfully set up a system where an AI interacts with Supabase for inserting or updating data (beyond just reading)?

I would appreciate any insights or examples of successful implementations.

 
Posted : 24/07/2025 11:27 am
jabbson
(@jabbson)
Posts: 40
Eminent Member
 

Hello! I hope you are doing well. Welcome to the community.

Could you please share your workflow? This would help us see how you're performing the insertion and review your prompts.

In the meantime, here's a working example of what I believe you're looking for:

Output in chat:

Output from the database:

 
Posted : 24/07/2025 3:00 pm
Dendan
(@dendan)
Posts: 2
New Member
Topic starter
 

Hello, and thank you for your reply with the example.

I've identified the difference between your setup and mine. It appears I had explicitly defined the parameters to be filled within the Supabase tool, leaving the rest to the AI. My assumption was that it would all work seamlessly, so I omitted these fields, whereas you included them. I've replicated your approach, and it's now functioning correctly. Thanks again!

 
Posted : 24/07/2025 3:31 pm
jabbson
(@jabbson)
Posts: 40
Eminent Member
 

Awesome. Glad I could help, kindly

:heart:

the answer which helped to figure out the issue.

Cheers.

 
Posted : 24/07/2025 3:36 pm
Share: