Re: [BUGS] possible INSERT bug

2002-12-13 Thread Tom Lane
"Mathew Frank" <[EMAIL PROTECTED]> writes:
>  CREATE FUNCTION insert_record_return_oid(text) RETURNS int4 AS
>  ' DECLARE
>  s_query ALIAS FOR $1;
>  oid int4;
>  BEGIN
>  EXECUTE s_query;
>  GET DIAGNOSTICS oid = RESULT_OID;
>  RETURN oid;
>  END;
>  ' LANGUAGE 'plpgsql' with (ISSTRICT);

>  select * from sys_states
>  where oid= insert_record_return_oid('insert into sys_states (s_state)
>  values(''po'') ');

>  "Cannot insert duplicate key" and the insert query never happens.

Assuming you've got more than one row in sys_states already, this isn't
surprising: the function is invoked again for each row to compare to the
row's oid, and on the second row you barf with a unique-key failure.

If you'd not had the unique restriction in place, it'd still not have
done what you wanted, because the rows inserted by the function would be
newer than the start time of the outer query and thus would not be
visible to it.

It might be that you could make this work by marking the function
iscachable (or immutable in 7.3) so that the planner folds the function
call to a constant before the outer query actually starts.  But this
strikes me as an unwarranted dependence on implementation details.

regards, tom lane

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



[BUGS] select for update problem (maybe mine)

2002-12-13 Thread Theodore Petrosky
Is this a bug or is this how it is supposed to work?

postgresql 7.3 (release)
mac osx 10.2.2

select for update

I have two terminal sessions open with psql running
and talking to the same db.

in window 1 : begin;
in window 1 : select column1 from table where column1
= 'text' for update;

in window 2 : update table set column1  = 'text 2'
where column1 = 'text';

then nothing...(until I commit window 1 then window 2
just does the update)
.. I expected an error or warning in window 2... sorry
column/row locked for update...

how can I trap for this. If client 1 is updating,
client 2 needs to know, not just be stuck waiting.
He/She has no idea why there is a delay.

but then again, maybe I am using this wrong.

Thanks,

Ted

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [BUGS] postmaster segfaults when pg_hba.cof is missing

2002-12-13 Thread Bruce Momjian

[ Will be backpatched.]

Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---


Neil Conway wrote:
> On Thu, 2002-12-12 at 13:13, Rudy Lippan wrote:
> > I know this is a broken install, but postmaster should not segfault when 
> > it can't find a file.
> > 
> > postgres@war PGDATA $ ../pgsql7.3/bin/postmaster
> > LOG:  load_hba: Unable to open authentication config file 
> > "/usr/local/PGDATA/pgsql7.3/pg_hba.conf": No such file or directory
> > Segmentation fault (core dumped)
> 
> Good catch. Here's a patch against CVS HEAD that fixes the problem.
> 
> The actual segfault was caused by a double pfree(), but ISTM that
> failing to find pg_hba.conf should be a fatal error anyway, so I
> increased the priority of the elog() from LOG to FATAL and refactored
> the code a little bit.
> 
> Bruce: unless anyone has an objection, please apply.
> 
> Thanks for the report.
> 
> Cheers,
> 
> Neil

[ Attachment, skipping... ]

> 
> ---(end of broadcast)---
> TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [BUGS] server terminated by a query in 7.3

2002-12-13 Thread Frank van Vugt
> after I upgrade my postgresql from 7.2 to 7.3, one query always makes server
> terminated

This is caused by the vacuum of a temp table.

Tom fixed it already about a week ago and provided the patch here:



*** src/backend/storage/buffer/localbuf.c.orig  Wed Sep  4 16:31:25 2002
--- src/backend/storage/buffer/localbuf.c   Thu Dec  5 17:48:10 2002
***
*** 90,108 
{
Relationbufrel = 
RelationNodeCacheGetRelation(bufHdr->tag.rnode);
  
-   /*
-* The relcache is not supposed to throw away temp rels, so 
this
-* should always succeed.
-*/
-   Assert(bufrel != NULL);
- 
/* flush this page */
!   smgrwrite(DEFAULT_SMGR, bufrel, bufHdr->tag.blockNum,
! (char *) MAKE_PTR(bufHdr->data));
!   LocalBufferFlushCount++;
  
!   /* drop refcount incremented by RelationNodeCacheGetRelation 
*/
!   RelationDecrementReferenceCount(bufrel);
}
  
/*
--- 90,113 
{
Relationbufrel = 
RelationNodeCacheGetRelation(bufHdr->tag.rnode);
  
/* flush this page */
!   if (bufrel == (Relation) NULL)
!   {
!   smgrblindwrt(DEFAULT_SMGR,
!bufHdr->tag.rnode,
!bufHdr->tag.blockNum,
!(char *) 
MAKE_PTR(bufHdr->data));
!   }
!   else
!   {
!   smgrwrite(DEFAULT_SMGR, bufrel,
! bufHdr->tag.blockNum,
! (char *) MAKE_PTR(bufHdr->data));
!   /* drop refcount incremented by 
RelationNodeCacheGetRelation */
!   RelationDecrementReferenceCount(bufrel);
!   }
  
!   LocalBufferFlushCount++;
}
  
/*


Regards,





Frank.


---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])



Re: [BUGS] Bug #838: SSL problems in 7.3

2002-12-13 Thread Nathan Mueller
Ok, I think I've gotten this figured out now.  I saw this comment in pqcomm.c,
switched the ERROR logs to COMMERROR logs and it all works.  I've attached a
patch to be-secure.c that fixes all my problems.  Hopefully this is the right fix.

  --Nate

/*
 * Careful: an elog() that tries to write to the client would
 * cause recursion to here, leading to stack overflow and core
 * dump!  This message must go *only* to the postmaster log.
 */




sslpatch
Description: Binary data

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



Re: [BUGS] ecpg Oracle compatibility issue

2002-12-13 Thread Roland Karch
On Thu, Dec 12, 2002 at 04:49:30PM -0500, Bruce Momjian wrote:
> I applied the attached patch. Your version looked like it would have
> doubled the double-quotes.

Oops - yes, I got that wrong.

> As you mentioned, you couldn't get bison to
> work, so you weren't able to test it.  Please look over this patch and
> make sure it is correct.

It works fine, just got bison to work on my other computer.

> Also check the other use of ECPGdisconnect(). 
> Is that correct?  Does it need "CURRENT"?

Yes, it's needed. Supplying a NULL pointer instead results in a segfault
for me. However, it would work if src/interfaces/ecpg/lib/connect.c line
468 was patched - checking for NULL before dereferencing a user-supplied
pointer is generally a good idea.

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])



Re: [BUGS] ecpg Oracle compatibility issue

2002-12-13 Thread Bruce Momjian

OK, patch applied. Thanks.

---

Roland Karch wrote:
> On Thu, Dec 12, 2002 at 04:49:30PM -0500, Bruce Momjian wrote:
> > I applied the attached patch. Your version looked like it would have
> > doubled the double-quotes.
> 
> Oops - yes, I got that wrong.
> 
> > As you mentioned, you couldn't get bison to
> > work, so you weren't able to test it.  Please look over this patch and
> > make sure it is correct.
> 
> It works fine, just got bison to work on my other computer.
> 
> > Also check the other use of ECPGdisconnect(). 
> > Is that correct?  Does it need "CURRENT"?
> 
> Yes, it's needed. Supplying a NULL pointer instead results in a segfault
> for me. However, it would work if src/interfaces/ecpg/lib/connect.c line
> 468 was patched - checking for NULL before dereferencing a user-supplied
> pointer is generally a good idea.
> 
> ---(end of broadcast)---
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
> 

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

Index: src/interfaces/ecpg/preproc/preproc.y
===
RCS file: /cvsroot/pgsql-server/src/interfaces/ecpg/preproc/preproc.y,v
retrieving revision 1.204
diff -c -c -r1.204 preproc.y
*** src/interfaces/ecpg/preproc/preproc.y   12 Dec 2002 21:50:01 -  1.204
--- src/interfaces/ecpg/preproc/preproc.y   13 Dec 2002 20:27:24 -
***
*** 554,560 
if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "no at option for 
disconnect statement.\n");
  
!   fprintf(yyout, "{ ECPGdisconnect(__LINE__, %s);", $1);
whenever_action(2);
free($1);
}
--- 554,561 
if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "no at option for 
disconnect statement.\n");
  
!   fprintf(yyout, "{ ECPGdisconnect(__LINE__, %s);",
!   $1 ? $1 : "\"CURRENT\"");
whenever_action(2);
free($1);
}


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



Re: [BUGS] OpenOffice loops calling SQLForeignKeys

2002-12-13 Thread Hiroshi Inoue
> -Original Message-
> From: Ocke Janssen
> 
> The call looks like
> 
> SQLRETURN nRetcode = N3SQLForeignKeys(m_aStatementHandle,
> (SDB_ODBC_CHAR *) pPKQ, (catalog.hasValue() 
> && aPKQ.getLength()) ? SQL_NTS : 0,
> (SDB_ODBC_CHAR *) pPKO, pPKO ? SQL_NTS : 0,
> (SDB_ODBC_CHAR *) pPKN, pPKN ? SQL_NTS : 0,
> (SDB_ODBC_CHAR *) pFKQ, (catalog2.hasValue() 
> && aFKQ.getLength()) ? SQL_NTS : 0,
> (SDB_ODBC_CHAR *) pFKO, pFKO ? SQL_NTS : 0,
> (SDB_ODBC_CHAR *) pFKN, SQL_NTS
> );
> 
> where the first 3 arguments are NULL. The last 3 contains the 
> information about one table.
> Another way to reproduce the bug would be to install the SRX643C version 
> of OpenOffice. I just heard from the [EMAIL PROTECTED] mailing list 
> that the snapshot 7.03.0001 shouldn't have the bug anymore.

Oops maybe my fault sorry. Please try the snapshot.

regards,
Hiroshi Inoue


---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])



Re: [BUGS] [ADMIN] PostgreSQL 7.3 installation on RedHat 8.0 fails

2002-12-13 Thread Tom Lane
Murthy Kambhampaty <[EMAIL PROTECTED]> writes:
> "/home/postgres/postgresql-7.3/src/test/regress/./tmp_check/install//usr/loc
> al/pgsql/bin/pg_encoding: relocation error:
> /home/postgres/postgresql-7.3/src/test/regress/./tmp_check/install//usr/loca
> l/pgsql/bin/pg_encoding: undefined symbol: pg_char_to_encoding

This usually means that the dynamic linker is picking up a version of
libpq.so that doesn't have MULTIBYTE support, but the program you are
trying to run requires MULTIBYTE.  Fix: update your ldconfig settings
so that the thing finds the version of libpq.so you just built, rather
than whatever old version it's finding.

pg_regress tries to get the system to notice the libpq.so that it
installed in the tmp_check/install area, but I believe it's quite a
ways short of making that work correctly everywhere.

regards, tom lane

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [BUGS] server terminated by a query in 7.3

2002-12-13 Thread Tom Lane
Jie Liang <[EMAIL PROTECTED]> writes:
> however, after
> I upgrade my postgresql from 7.2 to 7.3, one query always makes server
> terminated, could
> you give me a solution for it?

I cannot reproduce this with the information you gave.

regards, tom lane

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster