Skip to content

Commit e9c0ce0

Browse files
committed
improve
1 parent 458f6dd commit e9c0ce0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

201801/20180115_01.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,15 @@ where
135135

136136
a,b的新增数据持续写入a1,b1。
137137

138-
同时有两张a2,b2用于合并时的切换表
138+
需要注意的是,结构的一致性,并保持一致
139139

140140
![pic](20180115_01_pic_002.jpg)
141+
142+
同时有两张a2,b2用于合并时的切换表。
141143

142144
```
145+
-- 结构务必保持一致,而且将来改动a,b结构的时候a1,b1,a2,b2也要保持一致。
146+
143147
create table a1(like a);
144148
create table b1(like b);
145149
@@ -192,7 +196,7 @@ insert into c (id, tb, info, crt_time)
192196
select a.id, b.tb, a.info, a.crt_time from
193197
a
194198
join
195-
(select tid, array_agg(row(b.tid, b.info, b.status, b.crt_time)::b order by status) as tb from b3 b group by tid) b
199+
(select tid, array_agg(row(b.*)::b order by status) as tb from b3 b group by tid) b
196200
using (tid)
197201
on conflict (id)
198202
do update set

0 commit comments

Comments
 (0)