gpt4 book ai didi

sql - Postgres - 如何在表结构查询中检索默认值

转载 作者:行者123 更新时间:2023-11-29 14:08:18 25 4
gpt4 key购买 nike

我正在尝试使用此查询检索一些具有列默认值的表结构:

SELECT column_name, is_nullable, character_maximum_length, udt_name, default_value
FROM information_schema.columns
WHERE table_schema = 'public'
AND table_name = 'USER'
ORDER BY ordinal_position

但我找不到正确的值来选择默认值。我尝试了“default_value”,但它不起作用...

最佳答案

作为documented in the manual默认值在 column_default

中可用
SELECT column_name, is_nullable, character_maximum_length, udt_name, column_default
FROM information_schema.columns
WHERE table_schema = 'public'
AND table_name = 'USER'
ORDER BY ordinal_position

关于sql - Postgres - 如何在表结构查询中检索默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57426938/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com