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[];
|
_path:= ARRAY['schemas',_schema]::text[];
|
||||||
--_srce:= 'dcard';
|
--_srce:= 'dcard';
|
||||||
SELECT
|
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
|
INTO
|
||||||
_sql
|
_sql
|
||||||
FROM
|
FROM
|
||||||
|
@ -12,7 +12,7 @@ BEGIN
|
|||||||
_path:= ARRAY['schemas',_schema]::text[];
|
_path:= ARRAY['schemas',_schema]::text[];
|
||||||
--_srce:= 'dcard';
|
--_srce:= 'dcard';
|
||||||
SELECT
|
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
|
INTO
|
||||||
_sql
|
_sql
|
||||||
FROM
|
FROM
|
||||||
|
@ -10,10 +10,10 @@ SELECT
|
|||||||
FROM
|
FROM
|
||||||
tpsv.pncl_default r
|
tpsv.pncl_default r
|
||||||
WHERE
|
WHERE
|
||||||
--AND rec @> '{"Schedule#":"01AR"}'
|
"Schedule#" = '01AR'
|
||||||
--AND rec @> '{"Schedule#":"02IN Raw Material"}'
|
--"Schedule#" = '02IN Raw Material'
|
||||||
"Schedule#" = '03IN Finished Goods'
|
--"Schedule#" = '03IN Finished Goods'
|
||||||
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
"Schedule#" asc
|
"Schedule#" asc
|
||||||
,r."PostDate" asc
|
,r."PostDate" asc
|
||||||
|
,id
|
Loading…
Reference in New Issue
Block a user