From: xiong w. <wan...@gm...> - 2010-12-23 06:51:27
|
Hi, About the sequence, we tried to realize the executing by change the statement. For example, create table t(a int, b int default nextval('seq1')); If we insert a tuple like insert into t values(1), we replace the statement with insert into t values(1,2) (here, we assume nextval('seq1') is 2). But we met a problem that we couldn't process when we add a column with default nextval('seq1') into a table which has multiple tuples. Because the column needs increase automatically, we couldn't use a proper sequence value to replace the default value. For example: create table t1(a int); insert into t1 values(1),(1),(1); select * from t1; TEST=# select * from t1; A --- 1 1 1 (3 行) alter table t1 add column b int default nextval('seq1'); select * from t1; TEST=# select * from t1; A | B ---+---- 1 | 1 1 | 2 1 | 3 (3 行) Regards, Benny 在 2010年12月9日 上午9:15,Koichi Suzuki <ko...@in...> 写道: > This should be put into the track. > > I discussed with Michael and found that the issue is not that simple > because we should consider the case of the replicated table. It is not > correct to get sequence value directly from GTM to Datanode in this > case. Coordinator should handle this. > > Regards; > --- > Koichi > > (2010年12月09日 10:11), xiong wang wrote: >> Hi Koichi, >> >> Yes, I consider sequence should be created on datanodes but not only >> on coordinators. But all the sequence value should be from GTM. >> >> Regards, >> Benny >> >> 2010/12/9 Koichi Suzuki<ko...@in...>: >>> In the current implementation, sequence value is supplied by GTM, as you >>> know. It is assumed that this value is supplied to the datanode through >>> the coordinator. In the case of your case, default value must be handled >>> by the datanode and the datanode has to inquire GTM for the nextval of the >>> sequence. >>> >>> I'm afraid this is missing in the current code. >>> --- >>> Koichi >>> >>> (2010年12月08日 19:33), xiong wang wrote: >>>> >>>> Dears, >>>> >>>> steps: >>>> postgres=# create sequence seq start with 1; >>>> CREATE SEQUENCE >>>> postgres=# create table t(a int default nextval('seq'), b int); >>>> ERROR: Could not commit (or autocommit) data node connection >>>> >>>> datanode log as follows: >>>> LOG: statement: create table t(a int default nextval('seq'), b int); >>>> ERROR: relation "seq" does not exist >>>> >>>> When I checked the source code, I found sequence can't be created on >>>> datanodes. Could you explain why? >>>> >>>> Regards, >>>> Benny >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> What happens now with your Lotus Notes apps - do you make another costly >>>> upgrade, or settle for being marooned without product support? Time to >>>> move >>>> off Lotus Notes and onto the cloud with Force.com, apps are easier to >>>> build, >>>> use, and manage than apps on traditional platforms. Sign up for the Lotus >>>> Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d >>>> _______________________________________________ >>>> Postgres-xc-developers mailing list >>>> Pos...@li... >>>> https://lists.sourceforge.net/lists/listinfo/postgres-xc-developers >>>> >>> >>> >> > > |