[BUGS] BUG #5098: Levenshtein with costs is broken

2009-10-07 Thread Matthew Byrne

The following bug has been logged online:

Bug reference:  5098
Logged by:  Matthew Byrne
Email address:  matt...@hairybrain.co.uk
PostgreSQL version: 8.4.1
Operating system:   Linux x86_64 (Ubuntu 9.04)
Description:Levenshtein with costs is broken
Details: 

The Levenshtein with costs function in the fuzzystrmatch module is coded
incorrectly.  The initial values in the distance matrix are set up as 0, 1,
2 etc. when they should be 0, deletion_cost, (2 * deletion_cost)... and 0,
insertion_cost, (2 * insertion_cost) etc. respectively.  This causes the
function to return incorrect values, e.g.:

SELECT LEVENSHTEIN('ABC', 'XABC', 100, 100, 100)

returns 1 (the correct answer is 100).

To fix this, make the following changes to fuzzystrmatch.c:

Change line 244 from
prev[i] = i;
to
prev[i] = i * del_c;

and change line 255 from
curr[0] = j;
to
curr[0] = j * ins_c;

-- 
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 #5099: When MetaData is acquired, it becomes an SQL error.

2009-10-07 Thread konishi

The following bug has been logged online:

Bug reference:  5099
Logged by:  konishi
Email address:  a.kon...@gmail.com
PostgreSQL version: 8.4.1
Operating system:   FreeBSD 6.0
Description:When MetaData is acquired, it becomes an SQL error.
Details: 

In sample source and sample db
when used postgresql-8.4-701.jdbc3.jar is error
when used postgresql-8.3-603.jdbc3.jar is no error


The error disappears when "prepared.getParameterMetaData()" row delete. 


sample source:

String url = "jdbc:postgresql://XXX.XXX.XXX.XXX:5432/test";
Connection con = DriverManager.getConnection(url, "postgres", "test");
try{
String sql = "insert into test(filename,upddate) values(?,?)";
PreparedStatement prepared = con.prepareStatement(sql);
System.out.println("ParameterMetaData[" +
prepared.getParameterMetaData() + "]");
prepared.setString(1, "0");
prepared.setTimestamp(2, new
Timestamp(Calendar.getInstance().getTimeInMillis()));
prepared.executeUpdate();
}catch(Exception e){
System.out.println(e.getMessage());
}

sample table:
test=# \d+ test
   Table "public.test"
  Column  |Type |   Modifiers   | Storage  |
Description
--+-+---+--+
-
 filename | text|   | extended |
 upddate  | timestamp without time zone | default now() | plain|
Has OIDs: no

error message:
java.lang.IllegalArgumentException: Can't change resolved type for param: 1
from 1043 to 25
at
org.postgresql.core.v3.SimpleParameterList.setResolvedType(SimpleParameterLi
st.java:230)
at
org.postgresql.core.v3.QueryExecutorImpl.sendOneQuery(QueryExecutorImpl.java
:1488)
at
org.postgresql.core.v3.QueryExecutorImpl.sendQuery(QueryExecutorImpl.java:10
62)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)

at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.j
ava:479)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2St
atement.java:367)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2State
ment.java:321)
at JdbcTest.testJdbctest(JdbcTest.java:42)
...

-- 
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 #5100: Help me!!I want cause : "invalid page header in block xxxx",i need support to repair and avert

2009-10-07 Thread Viet Duc

The following bug has been logged online:

Bug reference:  5100
Logged by:  Viet Duc
Email address:  nv...@ifisolution.com
PostgreSQL version: 8.3.1
Operating system:   Window xp
Description:Help me!!I want cause : "invalid page header in block
",i need support to repair and avert
Details: 

Help me!!I want cause : "invalid page header in block ",i need support
to repair and avert.
--
2009-10-03 16:08:59 ICT LOG:  loaded library
"$libdir/plugins/plugin_debugger.dll"
2009-10-03 16:08:59 ICT LOG:  database system was interrupted; last known up
at 2009-10-03 16:04:18 ICT
2009-10-03 16:08:59 ICT FATAL:  the database system is starting up
2009-10-03 16:08:59 ICT LOG:  database system was not properly shut down;
automatic recovery in progress
2009-10-03 16:08:59 ICT LOG:  redo starts at 2/DC213F0
2009-10-03 16:09:00 ICT LOG:  loaded library
"$libdir/plugins/plugin_debugger.dll"
2009-10-03 16:09:00 ICT FATAL:  the database system is starting up
2009-10-03 16:09:01 ICT LOG:  loaded library
"$libdir/plugins/plugin_debugger.dll"
2009-10-03 16:09:01 ICT FATAL:  the database system is starting up
2009-10-03 16:09:02 ICT LOG:  record with zero length at 2/DC2FB38
2009-10-03 16:09:02 ICT LOG:  redo done at 2/DC2FB08
2009-10-03 16:09:02 ICT LOG:  last completed transaction was at log time
2009-10-03 16:04:36.562+07
2009-10-03 16:09:02 ICT LOG:  loaded library
"$libdir/plugins/plugin_debugger.dll"
2009-10-03 16:09:02 ICT FATAL:  the database system is starting up
2009-10-03 16:09:04 ICT LOG:  loaded library
"$libdir/plugins/plugin_debugger.dll"
2009-10-03 16:09:04 ICT FATAL:  the database system is starting up
2009-10-03 16:09:05 ICT LOG:  loaded library
"$libdir/plugins/plugin_debugger.dll"
2009-10-03 16:09:05 ICT FATAL:  the database system is starting up
2009-10-03 16:09:06 ICT LOG:  loaded library
"$libdir/plugins/plugin_debugger.dll"
2009-10-03 16:09:06 ICT FATAL:  the database system is starting up
2009-10-03 16:09:08 ICT LOG:  loaded library
"$libdir/plugins/plugin_debugger.dll"
2009-10-03 16:09:08 ICT FATAL:  the database system is starting up
2009-10-03 16:09:08 ICT LOG:  database system is ready to accept
connections
2009-10-03 16:09:09 ICT LOG:  autovacuum launcher started
2009-10-03 16:09:09 ICT LOG:  loaded library
"$libdir/plugins/plugin_debugger.dll"
2009-10-03 16:09:46 ICT LOG:  loaded library
"$libdir/plugins/plugin_debugger.dll"
2009-10-03 16:10:07 ICT LOG:  loaded library
"$libdir/plugins/plugin_debugger.dll"
2009-10-03 16:10:08 ICT LOG:  loaded library
"$libdir/plugins/plugin_debugger.dll"
2009-10-03 16:10:08 ICT LOG:  loaded library
"$libdir/plugins/plugin_debugger.dll"
2009-10-03 16:10:09 ICT LOG:  loaded library
"$libdir/plugins/plugin_debugger.dll"
2009-10-03 16:10:12 ICT LOG:  loaded library
"$libdir/plugins/plugin_debugger.dll"
2009-10-03 16:10:12 ICT LOG:  loaded library
"$libdir/plugins/plugin_debugger.dll"
2009-10-03 16:10:28 ICT ERROR:  invalid page header in block 20 of relation
"LOG"

-- 
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 #5101: Off-by-one error in bitncmp() in src/backend/utils/adt/network.c

2009-10-07 Thread Chris Mikkelson

The following bug has been logged online:

Bug reference:  5101
Logged by:  Chris Mikkelson
Email address:  cm...@qwest.net
PostgreSQL version: 8.4.1(+earlier)
Operating system:   all
Description:Off-by-one error in bitncmp() in
src/backend/utils/adt/network.c
Details: 

When comparing a number of bits divisible by 8, bitncmp() may dereference a
pointer one byte out
of bounds.

The following patch against 8.4.1 incorporates the fix made to bitncmp() in
the BIND source tree:

*** src/backend/utils/adt/network.c.orig2009-10-07
12:32:13.0 -0500
--- src/backend/utils/adt/network.c 2009-10-07 12:32:45.0 -0500
*** bitncmp(void *l, void *r, int n)
*** 972,979 
  
b = n / 8;
x = memcmp(l, r, b);
!   if (x)
!   return x;
  
lb = ((const u_char *) l)[b];
rb = ((const u_char *) r)[b];
--- 972,979 
  
b = n / 8;
x = memcmp(l, r, b);
!   if (x || (n % 8) == 0)
!   return (x);
  
lb = ((const u_char *) l)[b];
rb = ((const u_char *) r)[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] BUG #5103: "pg_ctl -w (re)start" fails with custom unix_socket_directory

2009-10-07 Thread Michael Renner

The following bug has been logged online:

Bug reference:  5103
Logged by:  Michael Renner
Email address:  michael.ren...@amd.co.at
PostgreSQL version: HEAD
Operating system:   Linux
Description:"pg_ctl -w (re)start" fails with custom
unix_socket_directory
Details: 

When using a non-standard unix_socket_directory setting, pg_ctl -w (re)start
fails because it checks for the socket file to appear in it's default
location.

-- 
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 #5103: "pg_ctl -w (re)start" fails with custom unix_socket_directory

2009-10-07 Thread Alvaro Herrera
Michael Renner wrote:

> When using a non-standard unix_socket_directory setting, pg_ctl -w (re)start
> fails because it checks for the socket file to appear in it's default
> location.

Yeah, this has been discussed before.  It's been suggested that pg_ctl
should parse postgresql.conf to figure out the settings, but no one has
gotten around to it.  Feel free to give it a whirl if you're so inclined.

Hmm, another idea would be to have a new postmaster switch that would
report the value of any given configuration option.  So pg_ctl wouldn't
have to get into the business of parsing the config file, but would
simply ask postmaster for the value (which already knows how to parse
the file).

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
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 #5103: "pg_ctl -w (re)start" fails with custom unix_socket_directory

2009-10-07 Thread Tom Lane
Alvaro Herrera  writes:
> Michael Renner wrote:
>> When using a non-standard unix_socket_directory setting, pg_ctl -w (re)start
>> fails because it checks for the socket file to appear in it's default
>> location.

> Yeah, this has been discussed before.  It's been suggested that pg_ctl
> should parse postgresql.conf to figure out the settings, but no one has
> gotten around to it.  Feel free to give it a whirl if you're so inclined.

> Hmm, another idea would be to have a new postmaster switch that would
> report the value of any given configuration option.  So pg_ctl wouldn't
> have to get into the business of parsing the config file, but would
> simply ask postmaster for the value (which already knows how to parse
> the file).

Neither of those things would fully fix the problem anyway; consider the
possibility that the actual setting came from someplace else, eg the
postmaster command line, or that the current contents of postgresql.conf
are out of sync with the postmaster's actual values (hardly unlikely for
a PGC_POSTMASTER setting).  This is not an easy thing to fix.

My current feeling about it is that setting unix_socket_directory as a
configuration parameter is only useful to those who are deliberately
trying to hide their postmaster from regular clients, in which case
the fact that pg_ctl -w fails could be seen as a feature not a bug.
The way to make it work is of course the same as for any other
client, eg put PGHOST=/socket/directory in your environment.

If you want an actually convenient-to-use setup with a nonstandard
socket directory, the way to do it is to set the socket directory at
build time (see DEFAULT_PGSOCKET_DIR).  Then you'll have a libpq that
knows where to look, and the pg_ctl issue goes away.

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] BUG #5101: Off-by-one error in bitncmp() in src/backend/utils/adt/network.c

2009-10-07 Thread Heikki Linnakangas
Chris Mikkelson wrote:
> The following bug has been logged online:
> 
> Bug reference:  5101
> Logged by:  Chris Mikkelson
> Email address:  cm...@qwest.net
> PostgreSQL version: 8.4.1(+earlier)
> Operating system:   all
> Description:Off-by-one error in bitncmp() in
> src/backend/utils/adt/network.c
> Details: 
> 
> When comparing a number of bits divisible by 8, bitncmp() may dereference a
> pointer one byte out
> of bounds.
> 
> The following patch against 8.4.1 incorporates the fix made to bitncmp() in
> the BIND source tree:

Thanks, applied.

-- 
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

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