How do I use a textinput as an argument for inserting a column to a PostgreSQL db?

Hey everyone!

I have a textinput that is used as an argument for creating a new column in my PostgreSQL db.
My SQL code is:

ALTER TABLE hydra
ADD {{textinput5.value}} INT;

where the textinput value may be something like "eggs". After submitting, I get an error "syntax error at or near "$1"". Not sure what the issue is, I'm very new to Retool.

Thanks in advance!

Hey @kevinTDS! This probably has to do with prepared statements. To interpolate JS into your query you'll need to disable them in your resource's settings.

1 Like

Hi @justin! Thanks for the quick reply. I don't have the checkbox for "disable converting queries to prepared statements" in my resource's settings :slightly_frowning_face:
Capture

Update: I recreated my db resource and "Disable converting queries to prepared statements
" reappeared. Disabling solved my issue. Thanks @justin!

1 Like

Any time @kevinTDS :slight_smile: