Fix display of types in GPDB.
parent
dbf760c6e7
commit
eae6f0427c
|
@ -111,6 +111,11 @@ class BaseTableView(PGChildNodeView):
|
|||
if server_type == 'gpdb' else
|
||||
'#{0}#'.format(ver)
|
||||
)
|
||||
self.data_type_template_path='datatype/sql/'+ (
|
||||
'#{0}#{1}#'.format(server_type, ver)
|
||||
if server_type == 'gpdb' else
|
||||
'#{0}#'.format(ver)
|
||||
)
|
||||
self.partition_template_path = 'partition/sql/#{0}#'.format(ver)
|
||||
|
||||
# Template for Column ,check constraint and exclusion
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
SELECT
|
||||
*
|
||||
FROM
|
||||
(SELECT
|
||||
format_type(t.oid,NULL) AS typname,
|
||||
CASE WHEN typelem > 0 THEN typelem ELSE t.oid END as elemoid,
|
||||
typlen, typtype, t.oid, nspname,
|
||||
(SELECT COUNT(1) FROM pg_type t2 WHERE t2.typname = t.typname) > 1 AS isdup,
|
||||
FALSE AS is_collatable
|
||||
FROM
|
||||
pg_type t
|
||||
JOIN
|
||||
pg_namespace nsp ON typnamespace=nsp.oid
|
||||
WHERE
|
||||
(NOT (typname = 'unknown' AND nspname = 'pg_catalog'))
|
||||
AND
|
||||
{{ condition }}
|
||||
{% if add_serials %}
|
||||
{# Here we will add serials types manually #}
|
||||
UNION SELECT 'smallserial', 0, 2, 'b', 0, 'pg_catalog', false, false
|
||||
UNION SELECT 'bigserial', 0, 8, 'b', 0, 'pg_catalog', false, false
|
||||
UNION SELECT 'serial', 0, 4, 'b', 0, 'pg_catalog', false, false
|
||||
{% endif %}
|
||||
) AS dummy
|
||||
ORDER BY nspname <> 'pg_catalog', nspname <> 'public', nspname, 1
|
|
@ -233,8 +233,14 @@ class TypeView(PGChildNodeView, DataTypeReader):
|
|||
# Declare allows acl on type
|
||||
self.acl = ['U']
|
||||
|
||||
# we will set template path for sql scripts
|
||||
self.template_path = 'type/sql/#{0}#'.format(self.manager.version)
|
||||
ver = self.manager.version
|
||||
server_type = self.manager.server_type
|
||||
# Set the template path for the SQL scripts
|
||||
self.template_path = 'type/sql/' + (
|
||||
'#{0}#{1}#'.format(server_type, ver)
|
||||
if server_type == 'gpdb' else
|
||||
'#{0}#'.format(ver)
|
||||
)
|
||||
|
||||
return f(*args, **kwargs)
|
||||
return wrap
|
||||
|
|
|
@ -95,7 +95,7 @@ class DataTypeReader:
|
|||
try:
|
||||
|
||||
SQL = render_template(
|
||||
'/datatype/sql/#{0}#/get_types.sql'.format(conn.manager.version),
|
||||
"/".join([self.data_type_template_path,'get_types.sql']),
|
||||
condition=condition,
|
||||
add_serials=add_serials)
|
||||
status, rset = conn.execute_2darray(SQL)
|
||||
|
|
Loading…
Reference in New Issue