[BUGS] Cannot dump 8.4.8 database using later versions

2011-11-14 Thread Josh Berkus
Severity: normal

Versions tested: 9.0.4 and 9.1.1
Installed from packages on Ubuntu

Reproduceability: 100% on this server
have not tried a test case yet

Steps:

1. large running 8.4.8 PostgreSQL database

2. /usr/lib/postgresql/9.1/bin/pg_dump -Fc -v -f test.dump dbname

3. dumps all table etc definitions correctly.  then:

pg_dump: saving database definition
pg_dump: SQL command failed
pg_dump: Error message from server: ERROR:  NEW used in query that is
not in a rule
LINE 1: ...END AS min_value, cache_value, is_cycled, is_called from new
^
pg_dump: The command was: SELECT sequence_name, start_value, last_value,
increment_by, CASE WHEN increment_by > 0 AND max_value =
9223372036854775807 THEN NULL  WHEN increment_by < 0 AND max_value =
-1 THEN NULL  ELSE max_value END AS max_value, CASE WHEN
increment_by > 0 AND min_value = 1 THEN NULL  WHEN increment_by < 0
AND min_value = -9223372036854775807 THEN NULL  ELSE min_value END
AS min_value, cache_value, is_cycled, is_called from new

(yes, that is the entire query, I checked the logs)

... somehow the query to dump the sequences is getting mangled.  Any
clue how?

-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

-- 
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] Cannot dump 8.4.8 database using later versions

2011-11-14 Thread Josh Berkus

> Seems you have a sequence called "new";  seems we don't handle that
> well.

Hmmm ... yes, you're correct.  Idiot users.

Interestingly, the sequence is no problem until 9.0.  8.4 handled it
fine.  I'd guess this is another example of where merging in plpgsql
broke something.

-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

-- 
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] Cannot dump 8.4.8 database using later versions

2011-11-14 Thread Bruce Momjian
Josh Berkus wrote:
> Severity: normal
> 
> Versions tested: 9.0.4 and 9.1.1
>   Installed from packages on Ubuntu
> 
> Reproduceability: 100% on this server
>   have not tried a test case yet
> 
> Steps:
> 
> 1. large running 8.4.8 PostgreSQL database
> 
> 2. /usr/lib/postgresql/9.1/bin/pg_dump -Fc -v -f test.dump dbname
> 
> 3. dumps all table etc definitions correctly.  then:
> 
> pg_dump: saving database definition
> pg_dump: SQL command failed
> pg_dump: Error message from server: ERROR:  NEW used in query that is
> not in a rule
> LINE 1: ...END AS min_value, cache_value, is_cycled, is_called from new
> ^
> pg_dump: The command was: SELECT sequence_name, start_value, last_value,
> increment_by, CASE WHEN increment_by > 0 AND max_value =
> 9223372036854775807 THEN NULL  WHEN increment_by < 0 AND max_value =
> -1 THEN NULL  ELSE max_value END AS max_value, CASE WHEN
> increment_by > 0 AND min_value = 1 THEN NULL  WHEN increment_by < 0
> AND min_value = -9223372036854775807 THEN NULL  ELSE min_value END
> AS min_value, cache_value, is_cycled, is_called from new
> 
> (yes, that is the entire query, I checked the logs)
> 
> ... somehow the query to dump the sequences is getting mangled.  Any
> clue how?

Seems you have a sequence called "new";  seems we don't handle that
well.

-- 
  Bruce Momjian  http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + It's impossible for everything to be true. +

-- 
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] Cannot dump 8.4.8 database using later versions

2011-11-14 Thread Josh Berkus

>> ... somehow the query to dump the sequences is getting mangled.  Any
>> clue how?
> 
> Seems you have a sequence called "new";  seems we don't handle that
> well.

So, tested this some more.  For some reason, 8.4's pg_dump would
recognize NEW as a reserved word and quote it before dumping.  9.0 and
later pg_dump does not.  Any ideas?

-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

-- 
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 #6292: java.sql.PreparedStatement.setNull() throws PSQLException

2011-11-14 Thread David Pinheiro

The following bug has been logged online:

Bug reference:  6292
Logged by:  David Pinheiro
Email address:  davidsantospinhe...@gmail.com
PostgreSQL version: 8.4
Operating system:   Linux
Description:java.sql.PreparedStatement.setNull() throws
PSQLException
Details: 

I'm trying to make:
java.sql.PreparedStatement.setNull(1,java.sql.Types.NULL);


But i get:
org.postgresql.util.PSQLException: ERROR: column "number_column" is of type
integer but expression is of type character varying
Hint: You will need to rewrite or cast the expression.


My code is something like:
if (String.valueOf(input_field) == "null"){
 statement.setNull(1, java.sql.Types.NULL);
} else {
 statement.setObject(1, valor);
}
statement.executeUpdate();


Java says:
org.postgresql.util.PSQLException: ERROR: column "number_column" is of type
integer but expression is of type character varying
  Hint: You will need to rewrite or cast the expression.
  Position: 159
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorI
mpl.java:2096)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.ja
va:1829)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)

at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.j
ava:510)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2St
atement.java:386)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2State
ment.java:332)
at
pt.cm_olhao.tecidoempresarial.database.estabelecimentos.EstabelecimentosFree
formStatementDelegate.storeRow(EstabelecimentosFreeformStatementDelegate.jav
a:160)



I have Postgresql 8.4 and postgresql-jdbc-8.4-703.

Thanks a lot!
David Pinheiro

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