[BUGS] BUG #2678: Create or replace function with OUT args

2006-10-06 Thread Jeff Trout

The following bug has been logged online:

Bug reference:  2678
Logged by:  Jeff Trout
Email address:  [EMAIL PROTECTED]
PostgreSQL version: 8.1.4
Operating system:   OSX 10.4.8 (Also occurs on FC4 w/kernel 2.6.16
Description:Create or replace function with OUT args
Details:

it seems there may be some bug with cache coherency when replacing  
functions
that use OUT arguments.  This happens on Linux (2.6.16 ) - same  
version of
PG. (I didn't test across the pg restart as others are using that  
system).
I've created and replaced hundreds of "normal" functions. so I think  
it has

to do with OUT params.

Here's a transcript:

skittlebrau:/tmp postgres$ cat broken2.sql
create or replace function cachebroken(p_id int, out o_val1 int, out  
o_val2

int)
as $$
BEGIN

o_val1 := 12;
o_val2 := 45;

END
$$
language 'plpgsql';
skittlebrau:/tmp postgres$ psql indie
Welcome to psql 8.1.4, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
   \h for help with SQL commands
   \? for help with psql commands
   \g or terminate with semicolon to execute query
   \q to quit

indie=# \i broken2.sql
CREATE FUNCTION
indie=# \i broken2.sql
CREATE FUNCTION
indie=# \i broken2.sql
CREATE FUNCTION
indie=# \i broken2.sql
CREATE FUNCTION
indie=# \q
skittlebrau:/tmp postgres$ psql indie
Welcome to psql 8.1.4, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
   \h for help with SQL commands
   \? for help with psql commands
   \g or terminate with semicolon to execute query
   \q to quit

indie=# \i broken2.sql
psql:broken2.sql:10: ERROR:  missing cache data for cache id 27
indie=# \i broken2.sql
psql:broken2.sql:10: ERROR:  missing cache data for cache id 27
indie=# \q
skittlebrau:/tmp postgres$ pg_ctl -D /usr/local/pgsql/data/ -m fast  
restart

waiting for postmaster to shut downLOG:  logger shutting down
 done
postmaster stopped
postmaster starting
skittlebrau:/tmp postgres$ psql indie
Welcome to psql 8.1.4, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
   \h for help with SQL commands
   \? for help with psql commands
   \g or terminate with semicolon to execute query
   \q to quit

indie=# \i broken2.sql
psql:broken2.sql:10: ERROR:  missing cache data for cache id 27
indie=# drop function cachebroken (int);
DROP FUNCTION
indie=# \i broken2.sql
CREATE FUNCTION
indie=# \q

Occurs on: indie=# select version();

version


 


--
 PostgreSQL 8.1.4 on powerpc-apple-darwin8.8.0, compiled by GCC
powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 (Apple Computer, Inc. build
5026)
(1 row)

indie=# select version();
  version

 


---
 PostgreSQL 8.1.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.0.1
20050727 (Red Hat 4.0.1-5)
(1 row)



a couple of the guys on irc have confirmed it on HEAD as well.
--
Jeff Trout <[EMAIL PROTECTED]>
http://www.dellsmartexitin.com/
http://www.stuarthamm.net/




---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
  choose an index scan if your joining column's datatypes do not
  match


Re: [BUGS] BUG #2678: Create or replace function with OUT args

2006-10-06 Thread Tom Lane
Jeff Trout <[EMAIL PROTECTED]> writes:
> it seems there may be some bug with cache coherency when replacing  
> functions that use OUT arguments.

Looks like SysCacheGetAttr is making an assumption no longer tenable
(if it ever was), namely that the caller is referencing the same
syscache the tuple was fetched from, rather than another one on the
same catalog.  It needs to be prepared to initialize the cache in case
this is the first reference.  Will fix.

regards, tom lane

---(end of broadcast)---
TIP 1: 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


[BUGS] BUG #2677: BCC 5.5 can't compile libpq 8.2 beta 1

2006-10-06 Thread CN

The following bug has been logged online:

Bug reference:  2677
Logged by:  CN
Email address:  [EMAIL PROTECTED]
PostgreSQL version: 8.2beta1
Operating system:   Win98
Description:BCC 5.5 can't compile libpq 8.2 beta 1
Details: 

In ~/src/interfaces/libpq/ the command

make -DCFG=Release -N -f bcc32

yields the errors:
---
MAKE Version 5.2  Copyright (c) 1987, 2000 Borland
Building the Win32 DLL and Static Library...

Configuration "Release"

bcc32.exe
-Ic:\Borland\Bcc55\include;..\..\include;..\..\include\port\win32;..\..\incl
ude\port\win32_msvc;..\..\port -n".\Release" -WD -c
-DFRONTEND;NDEBUG;WIN32;_WINDOWS;HAVE_VSNPRINTF;HAVE_STRDUP; -tWM   -a8 -X
-w-use -w-par -w-pia -w-csu -w-aus -w-ccc -O -Oi -OS -DNDEBUG win32.c
Borland C++ 5.6.4 for Win32 Copyright (c) 1993, 2002 Borland
win32.c:
Warning W8017 ..\..\include\pg_config.h 366: Redefinition of 'HAVE_STRDUP'
is not identical
Error E2209 ..\..\include\c.h 64: Unable to open include file 'crtdefs.h'
Error E2209 ..\..\include\c.h 88: Unable to open include file
'pg_config_os.h'
Error E2040 ..\..\include\port.h 336: Declaration terminated incorrectly
*** 3 errors in Compile ***

** error 1 ** deleting ".\Release\win32.obj"
--

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

   http://www.postgresql.org/docs/faq


[BUGS] BUG #2678: Create or replace function with OUT args

2006-10-06 Thread Jeff Trout

The following bug has been logged online:

Bug reference:  2678
Logged by:  Jeff Trout
Email address:  [EMAIL PROTECTED]
PostgreSQL version: 8.1.4
Operating system:   OSX 10.4.8 (Also occurs on FC4 w/kernel 2.6.16
Description:Create or replace function with OUT args
Details: 

it seems there may be some bug with cache coherency when replacing functions
that use OUT arguments.  This happens on Linux (2.6.16 ) - same version of
PG. (I didn't test across the pg restart as others are using that system). 
I've created and replaced hundreds of "normal" functions. so I think it has
to do with OUT params.

Here's a transcript:

skittlebrau:/tmp postgres$ cat broken2.sql 
create or replace function cachebroken(p_id int, out o_val1 int, out o_val2
int)
as $$
BEGIN

o_val1 := 12;
o_val2 := 45;

END
$$
language 'plpgsql';
skittlebrau:/tmp postgres$ psql indie
Welcome to psql 8.1.4, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
   \h for help with SQL commands
   \? for help with psql commands
   \g or terminate with semicolon to execute query
   \q to quit

indie=# \i broken2.sql  
CREATE FUNCTION
indie=# \i broken2.sql 
CREATE FUNCTION
indie=# \i broken2.sql 
CREATE FUNCTION
indie=# \i broken2.sql 
CREATE FUNCTION
indie=# \q
skittlebrau:/tmp postgres$ psql indie
Welcome to psql 8.1.4, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
   \h for help with SQL commands
   \? for help with psql commands
   \g or terminate with semicolon to execute query
   \q to quit

indie=# \i broken2.sql 
psql:broken2.sql:10: ERROR:  missing cache data for cache id 27
indie=# \i broken2.sql 
psql:broken2.sql:10: ERROR:  missing cache data for cache id 27
indie=# \q
skittlebrau:/tmp postgres$ pg_ctl -D /usr/local/pgsql/data/ -m fast restart
waiting for postmaster to shut downLOG:  logger shutting down
 done
postmaster stopped
postmaster starting
skittlebrau:/tmp postgres$ psql indie
Welcome to psql 8.1.4, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
   \h for help with SQL commands
   \? for help with psql commands
   \g or terminate with semicolon to execute query
   \q to quit

indie=# \i broken2.sql 
psql:broken2.sql:10: ERROR:  missing cache data for cache id 27
indie=# drop function cachebroken (int);
DROP FUNCTION
indie=# \i broken2.sql  
CREATE FUNCTION
indie=# \q

Occurs on: indie=# select version();
   version  
 

--
 PostgreSQL 8.1.4 on powerpc-apple-darwin8.8.0, compiled by GCC
powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 (Apple Computer, Inc. build
5026)
(1 row)

indie=# select version();
  version   
  

---
 PostgreSQL 8.1.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.0.1
20050727 (Red Hat 4.0.1-5)
(1 row)

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

   http://www.postgresql.org/docs/faq


Re: [BUGS] BUG #2674: libedit not detected

2006-10-06 Thread Bob Friesenhahn

On Wed, 4 Oct 2006, Tom Lane wrote:


"Bob Friesenhahn" <[EMAIL PROTECTED]> writes:

libedit-20060829-2.9 was installed to /usr/local.



Configure was executed like:
LDFLAGS=-L/usr/local/lib ./configure '--prefix=/opt/foo/postgresql'
'--with-openssl' '--enable-thread-safety' '--with-pam' '--with-python'
'--enable-integer-datetimes'



configure: error: history header not found


Apparently your compiler doesn't search /usr/local/include by default.


Actually, it does.  The current version of libedit 
(http://www.thrysoee.dk/editline/) does not provide a history.h 
header.  However, I created an empty history.h 
(/usr/local/include/editline/history.h) to fool configure and was able 
to get PostgreSQL working with libedit.  When built with libedit, the 
PostgreSQL sources do not seem to actually use the history.h header.


Due to the licensing issues, it would be very useful if the configure 
script provided a means to specify using libedit rather than 
libreadline.  With the current approach, libreadline is automatically 
used if it exists.  Libreadline always takes priority over libedit. 
I had to delete libreadline and its headers from my machine in order 
to use libedit.  Of course this broke a number of installed 
applications.



The recommended way to do this is to
configure --with-includes=/usr/local/include --with-libs=/usr/local/lib
rather than fooling with LDFLAGS or CPPFLAGS directly.


Ok, thanks.  The reason why I used this approach is that Apple's OS X 
provides a version of libedit which does not include the readline 
emulation and Apple's GCC searches /usr/lib prior to /usr/local/lib by 
default.


Bob
==
Bob Friesenhahn
[EMAIL PROTECTED], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,http://www.GraphicsMagick.org/


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


Re: [BUGS] BUG #2674: libedit not detected

2006-10-06 Thread Bob Friesenhahn

On Wed, 4 Oct 2006, Tom Lane wrote:


Bob Friesenhahn <[EMAIL PROTECTED]> writes:

Actually, it does.  The current version of libedit
(http://www.thrysoee.dk/editline/) does not provide a history.h
header.


Well, that was a pretty silly decision on their part ... are they just
trying to tick off people who are supporting both readline and libedit?


Probably so.


The reason why I used this approach is that Apple's OS X
provides a version of libedit which does not include the readline
emulation


Really?  Apple's version works just fine for me.


I am using the "Panther" version of OS X and there there is only a 
/usr/include/histedit.h there are no readline-related headers supplied 
with the OS and the emulation function does not exist in 
/usr/lib/libedit.dylib:


% nm /usr/lib/libedit.dylib |grep ' T '
88e94d04 T _el_beep
88e943dc T _el_deletestr
88e946f8 T _el_end
88e94a38 T _el_get
88e97780 T _el_getc
88e97884 T _el_gets
88e945ec T _el_init
88e94330 T _el_insertstr
88e94b3c T _el_line
88e96e20 T _el_parse
88e975bc T _el_push
88e94780 T _el_reset
88e94c88 T _el_resize
88e947b4 T _el_set
88e94b44 T _el_source
88e9e858 T _history
88e9e058 T _history_end
88e9df9c T _history_init
88e9eca0 T _tok_end
88e9ebb8 T _tok_init
88e9ece8 T _tok_line
88e9ec80 T _tok_reset

Bob
==
Bob Friesenhahn
[EMAIL PROTECTED], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,http://www.GraphicsMagick.org/


---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


[BUGS] BUG #2680: Update statement did not work with String object

2006-10-06 Thread Ravindra

The following bug has been logged online:

Bug reference:  2680
Logged by:  Ravindra
Email address:  [EMAIL PROTECTED]
PostgreSQL version: 8.1.4
Operating system:   Debian
Description:Update statement did not work with String object
Details: 

when i create a string object with the SQL statement and feed to
statement.executeUpdate(),nothing happens.
but if i write the sql with in statement.executeUpdate() it works.

Following code does not work
String sql="update FieldOptions set option_description='"+newValue+"'
where field_name='country' and
option_code='"+(this.countryCode.trim())+"'";
Connection cn=context.getDBConnection();
statement=cn.createStatement();
int res=statement.executeUpdate(sql);
cn.commit();

but instead of the "sql" String object if i feed the string directly it
works. as given below

int res=statement.executeUpdate("update FieldOptions set
option_description='"+newValue+"' where field_name='country' and
option_code='"+(this.countryCode.trim())+"'");


pleaese check 

thanks

ravindra

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

   http://www.postgresql.org/docs/faq


[BUGS] BUG #2679: Logon failure error 1069

2006-10-06 Thread thanigaivel

The following bug has been logged online:

Bug reference:  2679
Logged by:  thanigaivel
Email address:  [EMAIL PROTECTED]
PostgreSQL version: 8.0
Operating system:   Windows 2000 Professional
Description:Logon failure error 1069
Details: 

This is the error i have faced while starting the Postgres service in
windows 2000 professional 


" The PostgreSQL Database Server 8.0 service of a local computer cannot
begin. 

Error 1069: Service was not able to begin because it had failed in logon. "

Thanks 

Thanigaivel

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: [BUGS] BUG #2677: BCC 5.5 can't compile libpq 8.2 beta 1

2006-10-06 Thread Tom Lane
"CN" <[EMAIL PROTECTED]> writes:
> Warning W8017 ..\..\include\pg_config.h 366: Redefinition of 'HAVE_STRDUP'
> is not identical

I was wondering why all the .mak files bother to /D HAVE_STRDUP when
they don't deal with any of the other ones.  Shouldn't we remove that?
pg_config.h.win32 is certainly the right place to be handling this.

> Error E2209 ..\..\include\c.h 64: Unable to open include file 'crtdefs.h'

Does this exist for any Borland releases?  Dropping it into an
#if defined(__BORLANDC__) || defined(_MSC_VER)
was probably a mistake.

> Error E2209 ..\..\include\c.h 88: Unable to open include file
> 'pg_config_os.h'

Oversight, fixed this one.

> Error E2040 ..\..\include\port.h 336: Declaration terminated incorrectly

Not sure about this ... could random() be defined as a macro in your
installation?  (Is that pointing at the definition of random()?  I'm not
real sure which version of port.h you have.)  If so, we could fix it by
adding #define HAVE_RANDOM to pg_config.h.win32, but I'm not sure if
that has to be conditional on __BORLANDC__ ... do Mingw and MSVC not
have that function?

regards, tom lane

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [BUGS] BUG #2674: libedit not detected

2006-10-06 Thread Bruce Momjian
Bob Friesenhahn wrote:
> On Wed, 4 Oct 2006, Tom Lane wrote:
> 
> > "Bob Friesenhahn" <[EMAIL PROTECTED]> writes:
> >> libedit-20060829-2.9 was installed to /usr/local.
> >
> >> Configure was executed like:
> >> LDFLAGS=-L/usr/local/lib ./configure '--prefix=/opt/foo/postgresql'
> >> '--with-openssl' '--enable-thread-safety' '--with-pam' '--with-python'
> >> '--enable-integer-datetimes'
> >
> >> configure: error: history header not found
> >
> > Apparently your compiler doesn't search /usr/local/include by default.
> 
> Actually, it does.  The current version of libedit 
> (http://www.thrysoee.dk/editline/) does not provide a history.h 
> header.  However, I created an empty history.h 
> (/usr/local/include/editline/history.h) to fool configure and was able 
> to get PostgreSQL working with libedit.  When built with libedit, the 
> PostgreSQL sources do not seem to actually use the history.h header.
> 
> Due to the licensing issues, it would be very useful if the configure 
> script provided a means to specify using libedit rather than 
> libreadline.  With the current approach, libreadline is automatically 

8.2 will have configure --with-libedit-preferred.

-- 
  Bruce Momjian   [EMAIL PROTECTED]
  EnterpriseDBhttp://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [BUGS] BUG #2674: libedit not detected

2006-10-06 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes:
> Bob Friesenhahn wrote:
>> Due to the licensing issues, it would be very useful if the configure 
>> script provided a means to specify using libedit rather than 
>> libreadline.  With the current approach, libreadline is automatically 

> 8.2 will have configure --with-libedit-preferred.

Although it remains to be seen how many variants of libedit our code
actually works with :-(.  Bob, please do try CVS tip if you haven't
already.

regards, tom lane

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

   http://www.postgresql.org/docs/faq


[BUGS] string_to_array() is confused by ambiguous field separator

2006-10-06 Thread Tom Lane
Good:

regression=# select string_to_array('123xx456xx789', 'xx');
 string_to_array
-
 {123,456,789}
(1 row)

Not so good:

regression=# select string_to_array('123xx456xxx789', 'xx');
ERROR:  negative substring length not allowed

The proximate problem is that in the inner loop in text_position(),
if it finds a match but hasn't yet found matchnum of them, it advances
only one character instead of advancing over the whole match.  This
means it can report overlapping successive matches, which leads to an
invalid subscript calculation in text_to_array().  I think the correct
approach is to ignore overlapping matches, so that the result in the
second case would be
{123,456,x789}

There's another problem here, which is that the API of text_position()
is poorly chosen anyway: as defined, parsing a string of N fields
requires O(N^2) work.  It'd be better to pass it a starting character
number for the search instead of a field number to find, and to break
out the setup step so that we don't have to repeat the conversion to
pg_wchar format for each field.

Any objections?

regards, tom lane

---(end of broadcast)---
TIP 1: 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