Bug 1079368
Summary: | Postgres Plugin - Create New Database Table With Array columns Fails if length is specified | ||||||
---|---|---|---|---|---|---|---|
Product: | [JBoss] JBoss Operations Network | Reporter: | Matt Mahoney <mmahoney> | ||||
Component: | Plugin -- Other | Assignee: | Michael Burman <miburman> | ||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | Mike Foley <mfoley> | ||||
Severity: | high | Docs Contact: | |||||
Priority: | high | ||||||
Version: | JON 3.2 | CC: | ahovsepy, hrupp, miburman, myarboro, tsegismo | ||||
Target Milestone: | ER02 | Keywords: | Triaged | ||||
Target Release: | JON 3.3.0 | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2014-12-11 14:00:27 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Bug Depends On: | |||||||
Bug Blocks: | 1082792 | ||||||
Attachments: |
|
Description
Matt Mahoney
2014-03-21 13:38:59 UTC
Adding columns works in current master, this issue is because of used datatype. Arrays have different syntax when length is specified, however PostgreSQL does not use length information at all when creating arrays (as of 9.5 devel), they're all threated as unlimited. Fixed in master 153804c (plugin will ignore precision and length inputs if type is an array) I think you should: * check org.rhq.plugins.postgres.PostgresTableComponent#updateResourceConfiguration and detect if the user is trying to modify an array column type or alter the column to make it an array column * document in the plugin descriptor that this field has no effect when the column is an array Other than that, the changes look good to me I think the description is pretty good already: "if data_type identifies a character or bit string type, the declared maximum length; null for all other data types or if no maximum length was declared" As I understand it, it already says don't use it with arraytypes. For altering purposes, changing column types to an array is not going to usually work, as PostgreSQL doesn't know how to convert data from original format to an array, unless user creates a function that does not wanted conversion. So this will fail in any case when using the user interface. However, it should have the same behaviour when adding a new column to existing table. (In reply to Michael Burman from comment #5) > I think the description is pretty good already: > > "if data_type identifies a character or bit string type, the declared > maximum length; null for all other data types or if no maximum length was > declared" OK. > > As I understand it, it already says don't use it with arraytypes. For > altering purposes, changing column types to an array is not going to usually > work, as PostgreSQL doesn't know how to convert data from original format to > an array, unless user creates a function that does not wanted conversion. So > this will fail in any case when using the user interface. > > However, it should have the same behaviour when adding a new column to > existing table. I think we should no longer allow the column type to be altered. Can you please make it read-only and clean the part of the component code related to that? Commit 1079368 in master makes the behaviour consistent between update and create. I will create another ticket for removing the column altering. Copy-paste mistake, 29c49dd is the correct commit. Setting to modified as it is in release/jon3.3.x Moving to ON_QA as available to test with brew build of DR01: https://brewweb.devel.redhat.com//buildinfo?buildID=373993 Created attachment 923033 [details]
JON 3.3 DR01 - Server.log
Failed to verify against JON 3.3 DR01 UI Error details: java.lang.NullPointerException at org.rhq.plugins.postgres.PostgresTableComponent$ColumnDefinition.<init>(PostgresTableComponent.java:412) at org.rhq.plugins.postgres.PostgresDatabaseComponent.createResource(PostgresDatabaseComponent.java:219) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocation.call(ResourceContainer.java:759) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) Fixed in master: commit a6a94893c4136e02b082829e15b87de4f950c3ec Author: burmanm <miburman> Date: Fri Aug 1 11:57:23 2014 +0300 [BZ 1079368] Fix potential NPE in nullable column Cherry-picked over to release/jon3.3.x commit 2c87ecbf363c63f1135606507507b3000b085885 Author: burmanm <miburman> Date: Fri Aug 1 11:57:23 2014 +0300 [BZ 1079368] Fix potential NPE in nullable column (cherry picked from commit a6a94893c4136e02b082829e15b87de4f950c3ec) Signed-off-by: Thomas Segismont <tsegismo> Moving to ON_QA as available for test with the following brew build: https://brewweb.devel.redhat.com//buildinfo?buildID=381194 |