User defined columns in Postgres #258

Open
opened 2015-06-14 08:53:23 +00:00 by shinji62 · 4 comments
shinji62 commented 2015-06-14 08:53:23 +00:00 (Migrated from github.com)

Hi,

It seems that user-defined columns are not support in postgres dialect. can be noice if xorg can support it
because I can not backup my database with it.

[xorm] [info]  2015/06/14 17:42:33.719688 [sql] SELECT column_name, column_default, is_nullable, data_type, character_maximum_length, numeric_precision, numeric_precision_radix ,
    CASE WHEN p.contype = 'p' THEN true ELSE false END AS primarykey,
    CASE WHEN p.contype = 'u' THEN true ELSE false END AS uniquekey
FROM pg_attribute f
    JOIN pg_class c ON c.oid = f.attrelid JOIN pg_type t ON t.oid = f.atttypid
    LEFT JOIN pg_attrdef d ON d.adrelid = c.oid AND d.adnum = f.attnum
    LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
    LEFT JOIN pg_constraint p ON p.conrelid = c.oid AND f.attnum = ANY (p.conkey)
    LEFT JOIN pg_class AS g ON p.confrelid = g.oid
    LEFT JOIN INFORMATION_SCHEMA.COLUMNS s ON s.column_name=f.attname AND c.relname=s.table_name
WHERE c.relkind = 'r'::char AND c.relname = $1 AND f.attnum > 0 ORDER BY f.attnum; [billing_events]
[xorm] [info]  2015/06/14 17:42:33.721043 [sql] SELECT indexname, indexdef FROM pg_indexes WHERE schemaname='public' AND tablename=$1 [billing_events]
[xorm] [info]  2015/06/14 17:42:33.725083 [sql] SELECT column_name, column_default, is_nullable, data_type, character_maximum_length, numeric_precision, numeric_precision_radix ,
    CASE WHEN p.contype = 'p' THEN true ELSE false END AS primarykey,
    CASE WHEN p.contype = 'u' THEN true ELSE false END AS uniquekey
FROM pg_attribute f
    JOIN pg_class c ON c.oid = f.attrelid JOIN pg_type t ON t.oid = f.atttypid
    LEFT JOIN pg_attrdef d ON d.adrelid = c.oid AND d.adnum = f.attnum
    LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
    LEFT JOIN pg_constraint p ON p.conrelid = c.oid AND f.attnum = ANY (p.conkey)
    LEFT JOIN pg_class AS g ON p.confrelid = g.oid
    LEFT JOIN INFORMATION_SCHEMA.COLUMNS s ON s.column_name=f.attname AND c.relname=s.table_name
WHERE c.relkind = 'r'::char AND c.relname = $1 AND f.attnum > 0 ORDER BY f.attnum; [service_auth_tokens]
2015/06/14 17:42:33 Error during Backup Postgres:  unkonw colType USER-DEFINED

Thanks

Hi, It seems that user-defined columns are not support in postgres dialect. can be noice if xorg can support it because I can not backup my database with it. ``` sql [xorm] [info] 2015/06/14 17:42:33.719688 [sql] SELECT column_name, column_default, is_nullable, data_type, character_maximum_length, numeric_precision, numeric_precision_radix , CASE WHEN p.contype = 'p' THEN true ELSE false END AS primarykey, CASE WHEN p.contype = 'u' THEN true ELSE false END AS uniquekey FROM pg_attribute f JOIN pg_class c ON c.oid = f.attrelid JOIN pg_type t ON t.oid = f.atttypid LEFT JOIN pg_attrdef d ON d.adrelid = c.oid AND d.adnum = f.attnum LEFT JOIN pg_namespace n ON n.oid = c.relnamespace LEFT JOIN pg_constraint p ON p.conrelid = c.oid AND f.attnum = ANY (p.conkey) LEFT JOIN pg_class AS g ON p.confrelid = g.oid LEFT JOIN INFORMATION_SCHEMA.COLUMNS s ON s.column_name=f.attname AND c.relname=s.table_name WHERE c.relkind = 'r'::char AND c.relname = $1 AND f.attnum > 0 ORDER BY f.attnum; [billing_events] [xorm] [info] 2015/06/14 17:42:33.721043 [sql] SELECT indexname, indexdef FROM pg_indexes WHERE schemaname='public' AND tablename=$1 [billing_events] [xorm] [info] 2015/06/14 17:42:33.725083 [sql] SELECT column_name, column_default, is_nullable, data_type, character_maximum_length, numeric_precision, numeric_precision_radix , CASE WHEN p.contype = 'p' THEN true ELSE false END AS primarykey, CASE WHEN p.contype = 'u' THEN true ELSE false END AS uniquekey FROM pg_attribute f JOIN pg_class c ON c.oid = f.attrelid JOIN pg_type t ON t.oid = f.atttypid LEFT JOIN pg_attrdef d ON d.adrelid = c.oid AND d.adnum = f.attnum LEFT JOIN pg_namespace n ON n.oid = c.relnamespace LEFT JOIN pg_constraint p ON p.conrelid = c.oid AND f.attnum = ANY (p.conkey) LEFT JOIN pg_class AS g ON p.confrelid = g.oid LEFT JOIN INFORMATION_SCHEMA.COLUMNS s ON s.column_name=f.attname AND c.relname=s.table_name WHERE c.relkind = 'r'::char AND c.relname = $1 AND f.attnum > 0 ORDER BY f.attnum; [service_auth_tokens] 2015/06/14 17:42:33 Error during Backup Postgres: unkonw colType USER-DEFINED ``` Thanks

Yes, it's still not defined.

Yes, it's still not defined.
shinji62 commented 2015-06-15 00:39:28 +00:00 (Migrated from github.com)

Can you prioritize it ?

Can you prioritize it ?

OKay. I will learn postgres USER-DEFINED feature first. Any document do you know about that?

OKay. I will learn postgres USER-DEFINED feature first. Any document do you know about that?
shinji62 commented 2015-06-15 02:00:00 +00:00 (Migrated from github.com)
http://www.sqlines.com/postgresql/how-to/create_user_defined_type
lunny added this to the (deleted) milestone 2021-06-09 04:23:48 +00:00
lunny modified the milestone from 1.2.0 to 1.2.0 2021-06-12 04:00:48 +00:00
lunny removed the
kind
bug
label 2021-07-11 14:58:37 +00:00
lunny modified the milestone from 1.2.0 to 1.3.0 2021-07-11 14:58:40 +00:00
lunny modified the milestone from 1.3.0 to 2.0.0 2021-10-20 01:13:15 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/xorm#258
No description provided.