Re: [BUGS] make_greater_string() does not return a string in some cases

2011-07-08 Thread Robert Haas
On Fri, Jul 8, 2011 at 5:21 AM, Kyotaro HORIGUCHI
 wrote:
> Points to realize this follows,

Please add your patch to the next CommitFest.

https://commitfest.postgresql.org/action/commitfest_view/open

-- 
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 #6101: ALTER TABLE hangs with AccessExclusiveLock

2011-07-08 Thread Craig Ringer

On 8/07/2011 7:33 PM, Dmitry wrote:

The following bug has been logged online:

Bug reference:  6101
Logged by:  Dmitry
Email address:  y4gr5...@gmail.com
PostgreSQL version: 9.0.4
Operating system:   Debian i686 2.6.32-5-686-bigmem
Description:ALTER TABLE hangs with AccessExclusiveLock
Details:

ALTER locks the table AccessExclusiveLock and hangs.
I can break it with Ctrl-C in psql, but it 100% reproduces in any session.


Are there any other sessions running concurrently? Is a lock on the 
table you are trying to ALTER already held by another transaction 
according to pg_locks ?


So far there's no evidence that this is anything except locking doing 
its job.


--
Craig Ringer

POST Newspapers
276 Onslow Rd, Shenton Park
Ph: 08 9381 3088 Fax: 08 9388 2258
ABN: 50 008 917 717
http://www.postnewspapers.com.au/

--
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 #6099: Does pgcluster support hibernate?

2011-07-08 Thread Craig Ringer

On 8/07/2011 4:20 PM, zha...@iwgroup.com.cn wrote:

The following bug has been logged online:

Bug reference:  6099
Logged by:
Email address:  zha...@iwgroup.com.cn
PostgreSQL version: 8.3
Operating system:   linux
Description:Does pgcluster support hibernate?
Details:

We have a application which connect postgresql database via hibernate. It
works on postgres without pgcluster,but not on pgcluster. Does pgcluster
officially support hibernate? Thanks!


This is a bug report form, not a form for general questions. If you want 
help, ask on the pgsql-general mailing list.


Is this a school or university project?

This is the third non-bug-report question we've had submitted on the bug 
report form within a week that's been related to pgcluster from someone 
in China. It's around the start of the second semester at many 
universities. I'm wondering if some university lecturer has set a 
project that uses an old version of PostgreSQL and pgcluster for something.


--
Craig Ringer

POST Newspapers
276 Onslow Rd, Shenton Park
Ph: 08 9381 3088 Fax: 08 9388 2258
ABN: 50 008 917 717
http://www.postnewspapers.com.au/

--
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 #6098: pgcluster

2011-07-08 Thread Craig Ringer

On 8/07/2011 3:56 PM, wbc wrote:

The following bug has been logged online:

Bug reference:  6098
Logged by:  wbc
Email address:  wbc_...@163.com
PostgreSQL version: 8.3.8
Operating system:   linux5.5
Description:pgcluster
Details:

pgcluster is obsolete and abandoned.

Look into Bucardo, Slony-I, pgbouncer, pgpool, etc.

For more questions please try posting on the pgsql-general mailing list 
(almost all in english) or in one of the language-specific mailing lists 
you'll see here: http://www.postgresql.org/community/lists/ . I don't 
see any lists specifically for Chinese (?) but there may be internet 
forums or similar dedicated to PostgreSQL in your preferred language.


--
Craig Ringer

POST Newspapers
276 Onslow Rd, Shenton Park
Ph: 08 9381 3088 Fax: 08 9388 2258
ABN: 50 008 917 717
http://www.postnewspapers.com.au/

--
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 #6103: Do not allow installation on Mac OS X Lion (GM)

2011-07-08 Thread Craig Ringer

On 9/07/2011 3:12 AM, Cesar Franco wrote:

The following bug has been logged online:

Bug reference:  6103
Logged by:  Cesar Franco
Email address:  ceauf...@gmail.com
PostgreSQL version: 9.0.4
Operating system:   Mac OS X 10.7 GM
Description:Do not allow installation on Mac OS X Lion (GM)
Details:

Do not allow installation on Mac OS X Lion (GM)


Er, why not?

Do you mean something like "When I try to install on Mac OS X Lion 
(10.7) I get an error that says ..." ?


Please try reporting again after reading this:

http://wiki.postgresql.org/wiki/Guide_to_reporting_problems

POST Newspapers
276 Onslow Rd, Shenton Park
Ph: 08 9381 3088 Fax: 08 9388 2258
ABN: 50 008 917 717
http://www.postnewspapers.com.au/

--
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 #6103: Do not allow installation on Mac OS X Lion (GM)

2011-07-08 Thread Cesar Franco

The following bug has been logged online:

Bug reference:  6103
Logged by:  Cesar Franco
Email address:  ceauf...@gmail.com
PostgreSQL version: 9.0.4
Operating system:   Mac OS X 10.7 GM
Description:Do not allow installation on Mac OS X Lion (GM)
Details: 

Do not allow installation on Mac OS X Lion (GM)

-- 
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 #6097: Server crash when enabling custom_variable_classes

2011-07-08 Thread Tom Lane
"Maxim Boguk"  writes:
> Description:Server crash when enabling custom_variable_classes

Fixed, thanks for the report.

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 #6102: JDBC BIND Source IP Address

2011-07-08 Thread Angel Dabov

The following bug has been logged online:

Bug reference:  6102
Logged by:  Angel Dabov
Email address:  o...@ustrem.org
PostgreSQL version: JDBC 8.3
Operating system:   Windows
Description:JDBC BIND Source IP Address
Details: 

Hi,

We have Tomcat Windows server with five applications which listen on
different IP addresses. Every application connects Postgres DB on different
server. These IP addresses are aliases on one NIC in same subnet.
The problem:
Every connection to the DB from JDBC driver bind different IP for source
address. We have firewall before DBs and need to use specific source ip
address for every application.
Is there any chance to fix in PGstream.java
socket(host, port) with socket(host, port, sourceaddress, null) and give us
prop to set sourceaddress?

Thank You,
Angel

-- 
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 #6101: ALTER TABLE hangs with AccessExclusiveLock

2011-07-08 Thread Dmitry

The following bug has been logged online:

Bug reference:  6101
Logged by:  Dmitry
Email address:  y4gr5...@gmail.com
PostgreSQL version: 9.0.4
Operating system:   Debian i686 2.6.32-5-686-bigmem
Description:ALTER TABLE hangs with AccessExclusiveLock
Details: 

ALTER locks the table AccessExclusiveLock and hangs.
I can break it with Ctrl-C in psql, but it 100% reproduces in any session.

Command: ALTER TABLE Amazon.Books ADD COLUMN textsearchable_index_col
tsvector;

Similar reports:
http://archives.postgresql.org/pgsql-admin/2002-04/msg00284.php
http://www.justskins.com/forums/how-to-release-a-133616.html

pg_locks: AccessExclusiveLock granted=f
ps:
postgres  3535  0.0  0.0  50064   652 ?Ss   Jul05   0:00 postgres:
al mydb [local] idle in transaction
postgres 22295  0.1  1.0  51804 34028 ?Ss   Jul03   7:18 postgres:
al mydb [local] ALTER TABLE waiting

Also, i can submit SQL table description, full pg_locks, pg_class,
pg_stat_activity.

-- 
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 #6099: Does pgcluster support hibernate?

2011-07-08 Thread

The following bug has been logged online:

Bug reference:  6099
Logged by:  
Email address:  zha...@iwgroup.com.cn
PostgreSQL version: 8.3
Operating system:   linux
Description:Does pgcluster support hibernate?
Details: 

We have a application which connect postgresql database via hibernate. It
works on postgres without pgcluster,but not on pgcluster. Does pgcluster
officially support hibernate? Thanks!

-- 
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 #6098: pgcluster

2011-07-08 Thread wbc

The following bug has been logged online:

Bug reference:  6098
Logged by:  wbc
Email address:  wbc_...@163.com
PostgreSQL version: 8.3.8
Operating system:   linux5.5
Description:pgcluster
Details: 

软件环境:
pgcluster-1.9.0rc7.tar.gz;postgresql-8.3.6.tar.bz2,

问题一:用用pgcluster做集群,如何只复制行级锁查询。
目前所有select语句都会复制,我只想让select  from table
for update 这种语句才复制。
问题二:用pgcluster做集群,应用通过hibernate3实现,发现如
下问题,求解:
1.在访问数据库时发先一个奇怪的问题,当hibernate配置文��
�时设置hibernate.jdbc.fetch_size属性时无法访问数据,程序就��
�挂死在那,当注释掉该配置时,一切恢复正常
2.应用是通过连接池与数据库建立长连接,但过了一段时��
�数据库自动会杀掉所有链接
问题三:用pgcluster做集群,如何只复制行级锁查询。
用pgcluster做集群,有两个库分别为A、B,但在A库执行一个s
elect,居然也分发到B库中,请问需要调整什么参数?

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


[BUGS] PostgreSQL fails to build with 32bit MinGW-w64

2011-07-08 Thread kmx
Hi,

couple of weeks ago postgresql introduced support for mingw-w64 compiler on
MS Windows platform; however the related patch was based on assumption that
mingw-w64 project delivers just 64bit compiler (which is not true - they
deliver both 32/64bit compilers).

According to my testing - postgresql-9.0.4 does compile fine with 64bit
mingw-w64 but fails with 32-bit mingw-w64 compiler.

Try to have a look at the enclosed patch which makes it possible to compile
postgresql-9.0.4 with 32bit mingw-w64.

--
kmx
diff -r -u -w --strip-trailing-cr 
/z/strawberry_libs/build/_wrk_libs2011_/postgresql-9.0.4/src/include/c.h 
/z/strawberry_libs/build/../patches/postgresql-9.0.4/src/include/c.h
--- /z/strawberry_libs/build/_wrk_libs2011_/postgresql-9.0.4/src/include/c.h
2011-04-15 03:15:53 +
+++ /z/strawberry_libs/build/../patches/postgresql-9.0.4/src/include/c.h
2011-05-06 11:39:13 +
@@ -58,17 +58,21 @@
 #endif
 #include "postgres_ext.h"
 
-#if _MSC_VER >= 1400 || defined(WIN64)
-#define errcode __msvc_errcode
-#include 
-#undef errcode
-#endif
-
 #include 
 #include 
 #include 
 #include 
 #include 
+
+/* note: __MINGW64_VERSION_MAJOR is related to both 32/bit gcc compiles by 
mingw-w64
+ * however it gots defined only after #include 
+ */
+#if _MSC_VER >= 1400 || defined(WIN64) || defined(__MINGW64_VERSION_MAJOR)
+#define errcode __msvc_errcode
+#include 
+#undef errcode
+#endif
+
 #ifdef HAVE_STRINGS_H
 #include 
 #endif
diff -r -u -w --strip-trailing-cr 
/z/strawberry_libs/build/_wrk_libs2011_/postgresql-9.0.4/src/include/port/win32.h
 /z/strawberry_libs/build/../patches/postgresql-9.0.4/src/include/port/win32.h
--- 
/z/strawberry_libs/build/_wrk_libs2011_/postgresql-9.0.4/src/include/port/win32.h
   2011-04-15 03:15:53 +
+++ 
/z/strawberry_libs/build/../patches/postgresql-9.0.4/src/include/port/win32.h   
2011-05-06 11:46:54 +
@@ -31,7 +31,7 @@
  * The Mingw64 headers choke if this is already defined - they
  * define it themselves.
  */
-#if !defined(WIN64) || defined(WIN32_ONLY_COMPILER)
+#if (!defined(WIN64) || defined(WIN32_ONLY_COMPILER)) && 
!defined(__MINGW64_VERSION_MAJOR)
 #define _WINSOCKAPI_
 #endif
 #include 
diff -r -u -w --strip-trailing-cr 
/z/strawberry_libs/build/_wrk_libs2011_/postgresql-9.0.4/src/port/getaddrinfo.c 
/z/strawberry_libs/build/../patches/postgresql-9.0.4/src/port/getaddrinfo.c
--- 
/z/strawberry_libs/build/_wrk_libs2011_/postgresql-9.0.4/src/port/getaddrinfo.c 
2011-04-15 03:15:53 +
+++ /z/strawberry_libs/build/../patches/postgresql-9.0.4/src/port/getaddrinfo.c 
2011-05-06 11:20:18 +
@@ -329,7 +329,7 @@
return "Not enough memory";
 #endif
 #ifdef EAI_NODATA
-#if !defined(WIN64) && !defined(WIN32_ONLY_COMPILER) /* MSVC/WIN64 duplicate */
+#if !defined(WIN64) && !defined(WIN32_ONLY_COMPILER) && 
!defined(__MINGW64_VERSION_MAJOR) /* MSVC/WIN64 duplicate */
case EAI_NODATA:
return "No host data of that type was found";
 #endif

-- 
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 #6097: Server crash when enabling custom_variable_classes

2011-07-08 Thread Tom Lane
"Maxim Boguk"  writes:
> Test case simple:
> start server with empty custom_variable_classes

> Then add to config file:

> custom_variable_classes = 'something'# list of custom
> variable class names
> something.location = 'ru'

> And then perform
> select pg_reload_conf();

> Ooops... you have no more working server (but client connections staying
> alive).

Hmm ... it's not exactly a crash, but an intentional postmaster exit;
the log shows

LOG:  received SIGHUP, reloading configuration files
LOG:  parameter "custom_variable_classes" changed to "something"
FATAL:  unrecognized configuration parameter "something.location"

Nonetheless, it's clearly not the desired behavior :-(.  Will look.

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


Re: [BUGS] make_greater_string() does not return a string in some cases

2011-07-08 Thread Kyotaro HORIGUCHI
Hello, Could you let me go on with this topic?

It is hard to ignore this glitch for us using CJK - Chinese,
Japanese, and Korean - characters on databse.. Maybe..

Saying on Japanese under the standard usage, about a hundred
characters out of seven thousand make make_greater_string() fail.

This is not so frequent to happen but also not as rare as
ignorable.

I think this glitch is caused because the method to derive the
`next character' is fundamentally a secret of each encoding but
now it is done in make_greater_string() using the method extended
from that of 1 byte ASCII charset for all encodings together.

 So, I think it is reasonable that encoding info table (struct
pg_wchar_tbl) holds the function to do that.

How about this idea?


Points to realize this follows,

- pg_wchar_tbl@pg_wchar.c has new element `charinc' that holds a
  function to increment a character of this encoding.

- Basically, the value of charinc is a `generic' increment
  function that does what make_greater_string() does in current
  implement.

- make_greater_string() now uses charinc for database encoding to
  increment characters instead of the code directly written in
  it.

- Give UTF-8 a special increment function.


As a consequence of this modification, make_greater_string()
looks somewhat simple thanks to disappearing of the sequence that
handles bare bytes in string.  And doing `increment character'
with the knowledge of the encoding can be straightforward and
light and backtrack-free, and have fewer glitches than the
generic method.

# But the process for BYTEAOID remains there dissapointingly.

There still remains some glitches but I think it is overdo to do
conversion that changes the length of the character. Only 5
points out of 17 thousands (in current method, roughly for all
BMP characters) remains, and none of them are not Japanese
character :-)

The attached patch is sample implement of this idea.

What do you think about this patch?

-- 
Kyotaro Horiguchi
NTT Open Source Software Center
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index 10b73fb..4151ce2 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -5502,6 +5502,16 @@ pattern_selectivity(Const *patt, Pattern_Type ptype)
 
 
 /*
+ * This function is "character increment" function for bytea used in
+ * make_greater_string() that has same interface with pg_wchar_tbl.charinc.
+ */
+static bool byte_increment(unsigned char *ptr, int len)
+{
+   (*ptr)--;
+   return true;
+}
+
+/*
  * Try to generate a string greater than the given string or any
  * string it is a prefix of.  If successful, return a palloc'd string
  * in the form of a Const node; else return NULL.
@@ -5540,6 +5550,7 @@ make_greater_string(const Const *str_const, FmgrInfo 
*ltproc, Oid collation)
int len;
Datum   cmpstr;
text   *cmptxt = NULL;
+   character_incrementer charincfunc;
 
/*
 * Get a modifiable copy of the prefix string in C-string format, and 
set
@@ -5601,27 +5612,38 @@ make_greater_string(const Const *str_const, FmgrInfo 
*ltproc, Oid collation)
}
}
 
+   if (datatype != BYTEAOID)
+   charincfunc = pg_database_encoding_character_incrementer();
+   else
+   charincfunc = &byte_increment;
+
while (len > 0)
{
-   unsigned char *lastchar = (unsigned char *) (workstr + len - 1);
-   unsigned char savelastchar = *lastchar;
+   int charlen;
+   unsigned char *lastchar;
+   unsigned char savelastbyte;
+   Const  *workstr_const;
+   
+   if (datatype == BYTEAOID)
+   charlen = 1;
+   else
+   charlen = len - pg_mbcliplen(workstr, len, len - 1);
+
+   lastchar = (unsigned char *) (workstr + len - charlen);
 
/*
-* Try to generate a larger string by incrementing the last 
byte.
+* savelastbyte has meaning only for datatype == BYTEAOID
 */
-   while (*lastchar < (unsigned char) 255)
-   {
-   Const  *workstr_const;
+   savelastbyte = *lastchar;
 
-   (*lastchar)++;
+   /*
+* Try to generate a larger string by incrementing the last 
byte or
+* character.
+*/
 
+   if (charincfunc(lastchar, charlen)) {
if (datatype != BYTEAOID)
-   {
-   /* do not generate invalid encoding sequences */
-   if (!pg_verifymbstr(workstr, len, true))
-   continue;
workstr_const = string_to_const(workstr, 
datatype);
-   }