sort collateral on id that needs to be in view, alter view creation to include ids
This commit is contained in:
parent
86f72b4d97
commit
da9e9b08f1
@ -319,7 +319,7 @@ BEGIN
|
||||
_path:= ARRAY['schemas',_schema]::text[];
|
||||
--_srce:= 'dcard';
|
||||
SELECT
|
||||
'CREATE VIEW tpsv.'||_srce||'_'||_path[2]||' AS SELECT '||string_agg('(allj#>>'''||r.PATH::text||''')::'||r.type||' AS "'||r.column_name||'"',', ')||' FROM tps.trans WHERE srce = '''||_srce||''''
|
||||
'DROP VIEW IF EXISTS tpsv.'||_srce||'_'||_path[2]||'; CREATE VIEW tpsv.'||_srce||'_'||_path[2]||' AS SELECT id, logid, '||string_agg('(allj#>>'''||r.PATH::text||''')::'||r.type||' AS "'||r.column_name||'"',', ')||' FROM tps.trans WHERE srce = '''||_srce||''';'
|
||||
INTO
|
||||
_sql
|
||||
FROM
|
||||
|
@ -12,7 +12,7 @@ BEGIN
|
||||
_path:= ARRAY['schemas',_schema]::text[];
|
||||
--_srce:= 'dcard';
|
||||
SELECT
|
||||
'CREATE VIEW tpsv.'||_srce||'_'||_path[2]||' AS SELECT '||string_agg('(allj#>>'''||r.PATH::text||''')::'||r.type||' AS "'||r.column_name||'"',', ')||' FROM tps.trans WHERE srce = '''||_srce||''''
|
||||
'DROP VIEW IF EXISTS tpsv.'||_srce||'_'||_path[2]||'; CREATE VIEW tpsv.'||_srce||'_'||_path[2]||' AS SELECT id, logid, '||string_agg('(allj#>>'''||r.PATH::text||''')::'||r.type||' AS "'||r.column_name||'"',', ')||' FROM tps.trans WHERE srce = '''||_srce||''';'
|
||||
INTO
|
||||
_sql
|
||||
FROM
|
||||
|
@ -10,10 +10,10 @@ SELECT
|
||||
FROM
|
||||
tpsv.pncl_default r
|
||||
WHERE
|
||||
--AND rec @> '{"Schedule#":"01AR"}'
|
||||
--AND rec @> '{"Schedule#":"02IN Raw Material"}'
|
||||
"Schedule#" = '03IN Finished Goods'
|
||||
|
||||
"Schedule#" = '01AR'
|
||||
--"Schedule#" = '02IN Raw Material'
|
||||
--"Schedule#" = '03IN Finished Goods'
|
||||
ORDER BY
|
||||
"Schedule#" asc
|
||||
,r."PostDate" asc
|
||||
,id
|
Loading…
Reference in New Issue
Block a user