Description of problem: Creating a new database table with columns fails with the following error: "org.postgresql.util.PSQLException:ERROR: syntax error at or near "(" Position: 43[SQLException=ERROR: syntax error at or near "(" Position: 43]" Version-Release number of selected component (if applicable): 3.2.2 How reproducible: Always Steps to Reproduce: 1. Click "Create Child", and select Table 2. Enter "New Resource Name" 3. Click "Next" button 4. Enter "Table Name" "Value" Add a Column, click "+": Column Name: <column Name> Type: char[] Length: 100 5. Click "OK", and then click "Finish" 6. Click "Child History", and then double click on new record to evaluate Status and error message. Actual results: Creating new tables with column(s) fails. Expected results: Creating new tables with columns should not fail. Additional info:
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