How to create a column with a function as its default value?
See original GitHub issueHi,
id: { type: 'uuid', primaryKey: true, defaultValue: 'uuid_generate_v4()' },
That column spec fails with
[WARN] Using unknown data type UUID
[ERROR] error: invalid input syntax for uuid: "uuid_generate_v4()"
at Connection.parseE (C:\Users\critc\AppData\Roaming\npm\node_modules\db-migrate-pg\node_modules\pg\lib\connection.js:539:11)
at Connection.parseMessage (C:\Users\critc\AppData\Roaming\npm\node_modules\db-migrate-pg\node_modules\pg\lib\connection.js:366:17)
at Socket.<anonymous> (C:\Users\critc\AppData\Roaming\npm\node_modules\db-migrate-pg\node_modules\pg\lib\connection.js:105:22)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:172:18)
at Socket.Readable.push (_stream_readable.js:130:10)
at TCP.onread (net.js:542:20)
Is there some special notation to stop it being treated as a literal?
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Add Column to Pandas DataFrame with a Default Value
The three ways to add a column to Pandas DataFrame with Default Value. Using pandas.DataFrame.assign(**kwargs); Using [] operator ...
Read more >Add new column to Pandas dataframe with default value
A step-by-step Python code example that shows how to add new column to Pandas DataFrame with default value. Provided by Data Interview Questions, ......
Read more >How to set a function as a default value in SQL Server?
What I want to do is to show first three characters of my first column's data which is Product_Name . For example my...
Read more >How to add a column with a default value to an existing table ...
To SQL add a column with a default value is a simple operation in SQL. Let us set up a 'student' table as...
Read more >Specify default column values | BigQuery - Google Cloud
Functions are evaluated when the data is written to the table. The type of the default value must match or coerce to the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
pgm.createExtension is not a function
can you help with this?
Here’s what works in May of 2021:
You’ll see [WARN] Using unknown data type UUID but it works.