Ah I see, thank you for sharing that @Alen_Ramic
This seems like a bug in the Retool Storage UI where it should be showing you the formula that is generating the value but for some reason it isn't.
The good news is that under the hood Retool DB is just a Postgres DB and we can use Postgres commands to get the info we need directly from a Retool Storage query and change the settings to make the column different as needed.
In PostgreSQL, you can query the default value expression for a column using the pg_attrdef system catalog, which stores column default values.
Here are a few ways to do this:
Method 1: Using pg_attrdef directly
SELECT pg_get_expr(d.adbin, d.adrelid) AS default_expression FROM pg_catalog.pg_attrdef d JOIN pg_catalog.pg_attribute a ON a.attrelid = d.adrelid AND a.attnum = d.adnum JOIN pg_catalog.pg_class c ON c.oid = a.attrelid WHERE c.relname = 'your_table_name' AND a.attname = 'your_column_name';
Method 2: Query information_schema
SELECT column_default FROM information_schema.columns WHERE table_name = 'your_table_name' AND column_name = 'your_column_name';
Method 3: See all defaults for a table
SELECT a.attname AS column_name, pg_get_expr(d.adbin, d.adrelid) AS default_expression FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum JOIN pg_catalog.pg_class c ON c.oid = a.attrelid WHERE c.relname = 'your_table_name' AND a.attnum > 0 AND NOT a.attisdropped AND d.adbin IS NOT NULL;
The pg_get_expr() function is important here because it converts the stored internal representation of the default expression into readable SQL.
Using psql's \d command: The simplest way is often just to use psql's describe command:
\d+ your_table_name
This will show you the table structure including default values in a human-readable format.