Re: [BUGS] BUG #5809: bigserial duplicate value

2011-01-12 Thread Robert Haas
On Sat, Jan 8, 2011 at 6:10 AM, melzaiady  wrote:
>
> http://postgresql.1045698.n5.nabble.com/file/n3332998/data1.jpg
>
> this picture of screen you can new sequence of value.
>
> now how can i slove this problem and this field dont start new squences in
> any time ?

It's pretty hard to tell what's actually going on here, but your
original complaint is that you're getting duplicate values, and there
are no duplicate values shown in this picture.  It's not even clear
that the sequence is resetting itself -- it might just be that the
values are sorted as strings rather than integers.  But if it is
getting reset, it's not happening magically behind the scenes - some
human being or program is resetting it.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] BUG #5816: index not used in function

2011-01-12 Thread Robert Haas
On Mon, Jan 10, 2011 at 9:07 PM, frank  wrote:
> More can be said, but why one wants to defend a defect is quite beyond me.

I guess the question is whether you want to solve your problem or
improve PostgreSQL.  If you want to solve your immediate problem, the
advice given thus far is probably enough for you to do it.  If the
goal is to improve PostgreSQL, that's a worthy goal and I don't think
anyone here would say otherwise.  The current behavior is not ideal,
but improving it is not easy.

When people say "it's not a bug", they don't mean "this is the best
possible behavior anyone can imagine"; they mean "we know that it
works this way and we haven't actually figured out a way to do any
better yet without causing other problems".

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] BUG #5816: index not used in function

2011-01-12 Thread Korry Douglas
Frank, thanks for educating me. 

-- Korry

> -Original Message-
> From: Korry Douglas [mailto:korry.doug...@enterprisedb.com] 
> Sent: Sunday, January 09, 2011 2:34 PM
> To: frank
> Cc: 'Kevin Grittner'; pgsql-bugs@postgresql.org
> Subject: Re: [BUGS] BUG #5816: index not used in function
> 
>  
> 
> > We may have different perceptions of something being a 'bug'. I always
> 
> > have several simple ways of determining it. One of them is when a
> 
> > work-around is in the proposal. Yours is one.
> 
>  
> 
> It seems to me that the important question in this case is whether or not the 
> query produced the correct result.
> 
> The important question by nature is not whether correct result is produce 
> eventually. In this case, the important thing is the inability to use the 
> index when in fact, if designed and implemented correctly, it could.
> 
>  
> 
> You are complaining about a performance issue, not a correctness issue, right?
> 
> No. I am pointing out a low-level-design/implementation defect. Poor 
> performance is the symptom. Poor performance due to sub-optimal execution of 
> the spec is a correctness issue. (See my comment on the nature of a function 
> below)
> 
>  
> 
> Kevin's work-around is meant to help you *gain better performance*, not to 
> obtain correct results when you are getting incorrect results.
> 
> If it is not a bug, why do we need a work-around?
> 
>  
> 
> > There can be quite a number of ways of looking at the issue. First, it
> 
> > is truly an implementation matter (making it in the true sense a bug). I
> 
> > do not believe that the spec would in formal way say that 'well, there
> 
> > are caveats where you have to do this and that to work around'.
> 
>  
> 
> The "spec" (by which I assume you mean the SQL standard) says nothing about 
> which execution plan will be selected (by) the optimizer.
> 
> No. Whatever the spec, it will never say that a function will not work as a 
> function, or something that works outside one will not work once moved inside.
> 
>  
> 
> > 
> 
> > If by 'kept from one execution to another' means that (the concept of) a
> 
> > plan is implemented static, this can be a low level design issue, which
> 
> > in general will still be regarded as implementation, thus a bug.
> 
>  
> 
> The execution plan is not quite static - it is computed the first time you 
> run the function (within a session) and is discarded when your session ends 
> (or when the compiled function/execution plan becomes obsolete because of a 
> change to a dependency).
> 
>  
> 
> That is by design.
> 
> Then the design is poor.
> 
>  
> 
> If you want a dynamic plan that is re-computed each time you execute the 
> query, you can get that behavior by using dynamic SQL, as Kevin suggested.
> 
>  
> 
> This seems far fetched and irrelevant. Whatever is truly static should be 
> implemented static; whatever is dynamic should be implemented dynamic; 
> whatever is partially static, the static part should be static and the 
> dynamic part should be dynamic. It is natural and correct treatment.
> 
>  
> 
> Purely dynamic situation in which the final query can not be determined in 
> any fashion, will have to be constructed either outside of the function or 
> within, so EXECUTE is the only way to handle. What do you think of requiring 
> the caller to construct such a static statement as “select count(*) from 
> sometable” and use EXECUTE?
> 
>  
> 
> By the same token, “select thiscolumn from thistable where upper(thiscolumn) 
> like $1” has to be treated statically for the static part. The only unknown 
> is the parameter, which can be, by the right design and implementation, 
> delayed till execution (runtime). The code to deal with this is what I 
> pointed out (via a conditional). If the plan is a piece of code, then the 
> conditional will be in it. If the plan is a piece of text to be further 
> interpreted for actual execution (why would one want to do it that way?), the 
> conditional could contain a text reference to two pieces of code (w/o the use 
> of the index). If it is not properly designed/implemented and such situation 
> results in the loss of the said ability, it is a defect to be addressed. 
> Whether one wants to address it is one issue. A defect is a defect.
> 
>  
> 
> You seem to suggest that the plan was only built at (the first) execution. 
> That is poor design/implementation.
> 
>  
> 
> Lastly, what is a function? One of the fundamental features of a function is 
> encapsulation. One is guaranteed some well-defined output based on 
> well-defined input. No implementation detail is necessary or is obliged to be 
> available. The user does not have to know what table or anything for that 
> matter is involved. When you push for what is suggested as a work-around, it 
> defeats one of the basic purposes for a function.
> 
>  
> 
> More can be said, but why one wants to defend a defect is quite beyond me.
> 
>  
> 
>   -- K

[BUGS] inheritance_planner() bug in 9.1

2011-01-12 Thread Jeff Davis
The attached SQL causes a crash in 9.1. It appears to be caused by:

d1001a78ce612a16ea622b558f5fc2b68c45ab4c

The patch tries to copy all of the important data out of the child
context before it's reset; but it doesn't get everything. For instance,
grouping_planner() allocates subroot.glob->paramlist, and uses it in
subsequent iterations; but that isn't copied before the context is
reset. It looks like there are other things that need copying as well,
but it wasn't immediately clear to me what the best fix is.

Regards,
Jeff Davis
begin;
create table parent1( a int);
create table child1 ( b int) inherits(parent1);

DELETE FROM parent1 USING (SELECT (SELECT a FROM parent1)) s;

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] inheritance_planner() bug in 9.1

2011-01-12 Thread Tom Lane
Jeff Davis  writes:
> The attached SQL causes a crash in 9.1. It appears to be caused by:
> d1001a78ce612a16ea622b558f5fc2b68c45ab4c

> The patch tries to copy all of the important data out of the child
> context before it's reset; but it doesn't get everything. For instance,
> grouping_planner() allocates subroot.glob->paramlist, and uses it in
> subsequent iterations; but that isn't copied before the context is
> reset. It looks like there are other things that need copying as well,
> but it wasn't immediately clear to me what the best fix is.

Ugh.  Maybe the best fix is to back that out.  I too am now unsure which
substructures of PlannerGlobal are at risk, and I don't really think
that hack was worth taking any risk of destabilizing the system for.

regards, tom lane

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


[BUGS] BUG #5833: error

2011-01-12 Thread chebeleu

The following bug has been logged online:

Bug reference:  5833
Logged by:  chebeleu
Email address:  chebe_ch...@yahoo.com
PostgreSQL version: 9.0.2
Operating system:   win7 ultimate
Description:error
Details: 

problem running post-instal. installation may not complete correctly
Error reading file C:/PROGRAM
fILES(X86)/PostgresSQL/9.0/data/postgressql.conf

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs