Properly handle truncated table names (> NAMEDATALEN). Fixes #2277

pull/3/head
Aravindraja Thinakaran 2017-04-01 02:57:48 -04:00 committed by Dave Page
parent 9acf340400
commit bb0bd8acc5
1 changed files with 6 additions and 0 deletions

View File

@ -1446,6 +1446,12 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
if not status:
return internal_server_error(errormsg=res)
# PostgreSQL truncates the table name to 63 characters.
# Have to truncate the name as like PostgreSQL to get the proper schema id
CONST_MAX_CHAR_COUNT = 63
if len(data['name']) > CONST_MAX_CHAR_COUNT:
data['name'] = data['name'][0:CONST_MAX_CHAR_COUNT]
# Get updated schema oid
SQL = render_template("/".join([self.template_path,
'get_schema_oid.sql']), tname=data['name'])