# If data sorting is none and not reset from the filter dialog then # set the data sorting in following conditions: # 1. When command type is VIEW_FIRST_100_ROWS or VIEW_LAST_100_ROWS. # 2. When command type is VIEW_ALL_ROWS and limit is greater than 0
if data_sorting isNoneand \ notself.is_sorting_set_from_filter_dialog() \ and (self.cmd_type in (VIEW_FIRST_100_ROWS, VIEW_LAST_100_ROWS) or (self.cmd_type == VIEW_ALL_ROWS andself.data_sorting_by_pk)): sorting = {'data_sorting': []} for pk in primary_keys: sorting['data_sorting'].append( {'name': pk, 'order': self.get_pk_order()}) self.set_data_sorting(sorting) data_sorting = self.get_data_sorting()
SELECT con.conkey FROM pg_catalog.pg_class rel LEFTOUTERJOIN pg_catalog.pg_constraint con ON con.conrelid=rel.oid JOIN pg_catalog.pg_namespace AS nsp ON nsp.oid=REL.relnamespace AND con.contype='p' WHERE rel.relkind IN ('r', 's', 't') AND rel.relname ='data_item' AND nsp.nspname='public'
SELECT at.attname, at.attnum, ty.typname FROM pg_catalog.pg_attribute AT LEFTJOIN pg_catalog.pg_type ty ON (ty.oid = at.atttypid) JOIN pg_catalog.pg_class AS cl ON cl.oid=AT.attrelid JOIN pg_catalog.pg_namespace AS nsp ON nsp.oid=cl.relnamespace WHERE cl.relname ='data_item' AND nsp.nspname='public' AND attnum =ANY ( (SELECT con.conkey FROM pg_catalog.pg_class rel LEFTOUTERJOIN pg_catalog.pg_constraint con ON con.conrelid=rel.oid JOIN pg_catalog.pg_namespace AS nsp ON nsp.oid=REL.relnamespace AND con.contype='p' WHERE rel.relkind IN ('r', 's', 't') AND rel.relname ='data_item' AND nsp.nspname='public' )::oid[])