Comments (7)
So, what - specifically - do you want changed?
PSQLException is a sub-class of SQLException. That said the interface for copyIn(string, Reader) allows for an IOException so wrapping it in a PSQLException (and by extension an SQLException) could be considered incorrect; though that does not appear to be your complaint anyway.
Getting a pg-specific error from a pg-specific class is something where maybe you can quibble on semantics but given the class-inheritance I'd say you are getting the best of both worlds.
Maybe something other than an IOException should occur but if you agree that the queries are invalid the distinction between the two is irrelevant since you couldn't recover from either in any meaningful way other that rewriting the query.
I don't see changing this to IOException because it really is the higher-level protocol, and not the I/O itself, that is generating the error. And making it explicitly an SQLException seems pointless and possibly harmful since callers would no longer be able to use "getServerErrorMessage()" on the error.
from pgjdbc.
As I stated in the title, the problem seems to arise when the DateStyle parameter is set, without it the exception messages are very clear. In fact, the problem is that:
- it confuses a regular message for an unexpected one, because PGSql resets the DateStyle parameter and informs the client about it;
- the message is not relevant and it is hard to debug the problem.
If the DateStyle parameter is not modified, the exceptions are very clear. For the first case (wrong query syntax):
Exception in thread "main" org.postgresql.util.PSQLException: ERROR: syntax error at or near "xxx"
Posizione: 34
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161)
at org.postgresql.core.v3.QueryExecutorImpl.processCopyResults(QueryExecutorImpl.java:966)
at org.postgresql.core.v3.QueryExecutorImpl.startCopy(QueryExecutorImpl.java:728)
at org.postgresql.copy.CopyManager.copyIn(CopyManager.java:52)
at org.postgresql.copy.CopyManager.copyIn(CopyManager.java:139)
at org.postgresql.copy.CopyManager.copyIn(CopyManager.java:124)
at sample.WrongQueryMain.main(WrongQueryMain.java:29)
For the second case:
Exception in thread "main" org.postgresql.util.PSQLException: ERROR: invalid input syntax for integer: "xxx1"
Dove: COPY sample, line 1, column id: "xxx1"
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161)
at org.postgresql.core.v3.QueryExecutorImpl.processCopyResults(QueryExecutorImpl.java:966)
at org.postgresql.core.v3.QueryExecutorImpl.endCopy(QueryExecutorImpl.java:828)
at org.postgresql.core.v3.CopyInImpl.endCopy(CopyInImpl.java:59)
at org.postgresql.copy.CopyManager.copyIn(CopyManager.java:145)
at org.postgresql.copy.CopyManager.copyIn(CopyManager.java:124)
at sample.WrongDataMain.main(WrongDataMain.java:30)
from pgjdbc.
Related pull request: #132
from pgjdbc.
Great! Thank you!
from pgjdbc.
I meet a question,please help me fix it.
Sqoop command arguments :
export
--connect
jdbc:postgresql://ip/test
--username
{user}
--password
{pw}
--table
dealers_target2
--direct
--export-dir
/user/hive/warehouse/path
-m
1
12728 [main] INFO org.apache.hadoop.mapreduce.Job - Job job_1499303596818_281263 running in uber mode : false
12731 [main] INFO org.apache.hadoop.mapreduce.Job - map 0% reduce 0%
18820 [main] INFO org.apache.hadoop.mapreduce.Job - map 100% reduce 0%
18828 [main] INFO org.apache.hadoop.mapreduce.Job - Job job_1499303596818_281263 failed with state FAILED due to: Task failed task_1499303596818_281263_m_000000
Job failed as tasks failed. failedMaps:1 failedReduces:0
18936 [main] INFO org.apache.hadoop.mapreduce.Job - Counters: 8
Job Counters
Failed map tasks=1
Launched map tasks=1
Data-local map tasks=1
Total time spent by all maps in occupied slots (ms)=14208
Total time spent by all reduces in occupied slots (ms)=0
Total time spent by all map tasks (ms)=3552
Total vcore-seconds taken by all map tasks=3552
Total megabyte-seconds taken by all map tasks=14548992
18943 [main] INFO org.apache.sqoop.mapreduce.ExportJobBase - Transferred 0 bytes in 14.2587 seconds (0 bytes/sec)
18945 [main] INFO org.apache.sqoop.mapreduce.ExportJobBase - Exported 0 records.
18947 [main] ERROR org.apache.sqoop.tool.ExportTool - Error during export:
Error: java.io.IOException: org.postgresql.util.PSQLException: Tried to end inactive copy at org.apache.sqoop.mapreduce.postgresql.PostgreSQLCopyExportMapper.cleanup(PostgreSQLCopyExportMapper.java:145) at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:148) at org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1783) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158) Caused by: org.postgresql.util.PSQLException: Tried to end inactive copy at org.postgresql.core.v3.QueryExecutorImpl.endCopy(QueryExecutorImpl.java:816) at org.postgresql.core.v3.CopyInImpl.endCopy(CopyInImpl.java:61) at org.apache.sqoop.mapreduce.postgresql.PostgreSQLCopyExportMapper.cleanup(PostgreSQLCopyExportMapper.java:142) ... 9 more
from pgjdbc.
Not exactly sure what you want us to do with this. Very difficult to figure out what the problem is with the information provided
from pgjdbc.
@davecramer mr task , extract data from hive to pg , An error is as follows
What are the usual reasons
from pgjdbc.
Related Issues (20)
- Feature: please support getObject(int, byte[].class) for bytea HOT 3
- batched updates + reWriteBatchedInserts + transactions does not return row count of affected rows HOT 10
- ResultSetMetaData.getColumnType() java.sql.Types.BOOLEAN field misidentified as BIT HOT 1
- 42.7.3 GitHub release jar is different from the jar on maven HOT 1
- NamedParameterJdbcTemplate execute complex Insert Query HOT 1
- feature request: Add support for native java unix sockets without needing JNI
- Postgres explain plan is not correctly optimezed if the data is a "double" but the collumn is a "numeric" HOT 10
- ResultSet.getObject throws exeception for 'Infinity'::numeric values HOT 4
- ARRAY() function return result problem HOT 2
- capitalization matters for PGInterval HOT 1
- PgStatement.executeWithFlags(sql, QueryMode.Simple) does not execute in Simple mode
- SQLWarnings returned on successful SQL statements HOT 28
- Provide Enum implementation of java.sql.SQLType interface? HOT 1
- Using Flink Datastream API to read and write PostgreSQL
- "ERROR: SET TRANSACTION ISOLATION LEVEL must not be called in a subtransaction" with autosave HOT 1
- SSLSocket duplex close failed (again) HOT 5
- Trying to update table using PreparadStatement, But parameters are generated inside a Parentheses HOT 1
- INSERT Java Boolean Type into a database BIT type will result in an incompatible type error. HOT 5
- Authentication SSL Mechanism HOT 20
- Query interceptors HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pgjdbc.