[JBoss JIRA] (TEIID-5397) RETURN_GENERATED_KEYS not working
by Ramesh Reddy (JIRA)
[ https://issues.jboss.org/browse/TEIID-5397?page=com.atlassian.jira.plugin... ]
Ramesh Reddy commented on TEIID-5397:
-------------------------------------
+1 for ALTER functionality. We could extend to UNIQUE, FOREIGN Keys too.
> RETURN_GENERATED_KEYS not working
> ---------------------------------
>
> Key: TEIID-5397
> URL: https://issues.jboss.org/browse/TEIID-5397
> Project: Teiid
> Issue Type: Bug
> Affects Versions: 10.2.1
> Reporter: Lukáš Svačina
> Assignee: Steven Hawkins
>
> *+VDB:+*
> {code}
> <vdb name="_GENERATED_form_shoes" version="2">
> <model name="_INTERNAL_internalModel" type="PHYSICAL">
> <source name="internal_postgresql" translator-name="postgresql" connection-jndi-name="java:/internal"/>
> </model>
> <model name="GEN_view" type="VIRTUAL">
> <metadata type="DDL">
> <![CDATA[ CREATE VIEW "_view_workflow_data" OPTIONS (UPDATABLE 'true')
> AS SELECT "public"."form_shoes_2"."size" AS "size", "public"."form_shoes_2"."model" AS "model",
> "public"."form_shoes_2"."id" AS "id" FROM "public"."form_shoes_2" ]]>
> </metadata>
> </model>
> </vdb>
> {code}
> *+TABLE:+*
> name: form_shoes_2
> columns: id (SERIAL) | size (INTEGER *NULLABLE*) | model (VARCHAR *NULLABLE*)
> *+PROBLEM:+*
> Connected into VDB using JDBC like:
> {code:java}
> final PreparedStatement statement = c.prepareStatement(...INSERT..., Statement.RETURN_GENERATED_KEYS);
> statement.executeUpdate();
> final ResultSet generatedKeys = statement.getGeneratedKeys();
> {code}
> *generatedKeys is empty if:*
> # INSERT INTO "form_shoes_2" ( "model" ) VALUES ( 'adidas x1' ) ...... e.g. not all columns are enumerated ... if so, you can provide NULL values to optional columns and generated keys WORK!
> # INSERT INTO "_view_workflow_data" (id, name, size) VALUES (42, 'adidas x2', 12 ) ....... e.g. insering into view (1:1, no joins involved) even when all columns ARE enumerated ... probably no way how to get generated keys here?
> *+QUESTIONS:+*
> # How to get last_insert_id() when inserting into foreign table/views (with/without joins)?
> # How to get updated rows (UPDATE ... RETURNING *)? At least primary keys of affected rows?
> Thanks for fixing/adding this functionality.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 5 months
[JBoss JIRA] (TEIID-5397) RETURN_GENERATED_KEYS not working
by Steven Hawkins (JIRA)
[ https://issues.jboss.org/browse/TEIID-5397?page=com.atlassian.jira.plugin... ]
Steven Hawkins commented on TEIID-5397:
---------------------------------------
[~rareddy] I think he's looking for the type mapping logic to be exposed somehow.
It seems like the easiest solution would be to add the alter handling for adding a primary key - or allowing constraints to be inferred from the query expression.
> RETURN_GENERATED_KEYS not working
> ---------------------------------
>
> Key: TEIID-5397
> URL: https://issues.jboss.org/browse/TEIID-5397
> Project: Teiid
> Issue Type: Bug
> Affects Versions: 10.2.1
> Reporter: Lukáš Svačina
> Assignee: Steven Hawkins
>
> *+VDB:+*
> {code}
> <vdb name="_GENERATED_form_shoes" version="2">
> <model name="_INTERNAL_internalModel" type="PHYSICAL">
> <source name="internal_postgresql" translator-name="postgresql" connection-jndi-name="java:/internal"/>
> </model>
> <model name="GEN_view" type="VIRTUAL">
> <metadata type="DDL">
> <![CDATA[ CREATE VIEW "_view_workflow_data" OPTIONS (UPDATABLE 'true')
> AS SELECT "public"."form_shoes_2"."size" AS "size", "public"."form_shoes_2"."model" AS "model",
> "public"."form_shoes_2"."id" AS "id" FROM "public"."form_shoes_2" ]]>
> </metadata>
> </model>
> </vdb>
> {code}
> *+TABLE:+*
> name: form_shoes_2
> columns: id (SERIAL) | size (INTEGER *NULLABLE*) | model (VARCHAR *NULLABLE*)
> *+PROBLEM:+*
> Connected into VDB using JDBC like:
> {code:java}
> final PreparedStatement statement = c.prepareStatement(...INSERT..., Statement.RETURN_GENERATED_KEYS);
> statement.executeUpdate();
> final ResultSet generatedKeys = statement.getGeneratedKeys();
> {code}
> *generatedKeys is empty if:*
> # INSERT INTO "form_shoes_2" ( "model" ) VALUES ( 'adidas x1' ) ...... e.g. not all columns are enumerated ... if so, you can provide NULL values to optional columns and generated keys WORK!
> # INSERT INTO "_view_workflow_data" (id, name, size) VALUES (42, 'adidas x2', 12 ) ....... e.g. insering into view (1:1, no joins involved) even when all columns ARE enumerated ... probably no way how to get generated keys here?
> *+QUESTIONS:+*
> # How to get last_insert_id() when inserting into foreign table/views (with/without joins)?
> # How to get updated rows (UPDATE ... RETURNING *)? At least primary keys of affected rows?
> Thanks for fixing/adding this functionality.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 5 months
[JBoss JIRA] (TEIID-5412) Catching exception in the LOOP results in assertion error, if exception is thrown by procedural call
by Steven Hawkins (JIRA)
[ https://issues.jboss.org/browse/TEIID-5412?page=com.atlassian.jira.plugin... ]
Steven Hawkins resolved TEIID-5412.
-----------------------------------
Fix Version/s: 11.1
10.3.3
11.0
Resolution: Done
The implicit "currentState" was not being cleaned up properly after the exception such that if the next command issued was the same as from the previous execution of the loop, then this exception would occur. The fix cleans up the current state just like all of the open cursors.
> Catching exception in the LOOP results in assertion error, if exception is thrown by procedural call
> ----------------------------------------------------------------------------------------------------
>
> Key: TEIID-5412
> URL: https://issues.jboss.org/browse/TEIID-5412
> Project: Teiid
> Issue Type: Bug
> Components: Query Engine
> Affects Versions: 10.2.1
> Environment: teiid-10.2.1 on WildFly Full 11.0.0.Final (WildFly Core 3.0.8.Final)
> Reporter: Ivan Semenov
> Assignee: Steven Hawkins
> Fix For: 11.1, 10.3.3, 11.0
>
>
> Loop Query fails with AssertionError in the stacktrace when exception is thrown by procedural call
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 5 months
[JBoss JIRA] (TEIID-5397) RETURN_GENERATED_KEYS not working
by Lukáš Svačina (JIRA)
[ https://issues.jboss.org/browse/TEIID-5397?page=com.atlassian.jira.plugin... ]
Lukáš Svačina edited comment on TEIID-5397 at 7/10/18 10:41 AM:
----------------------------------------------------------------
I need to figure out how exactly teiid makes columns' data type mapping in SQL syntax: "CREATE VIEW x AS SELECT a,b,c ..." because if I am forced to use SQL syntax: "CREATE VIEW x (a integer, b varchar, c integer) AS SELECT a,b,c ..." I do have to do this mapping manually in my code. I want to avoid this.
Of course I can get some information from table's information schema (source data types) but I have to figure out how to map them into TEIID's data types for VIEW usage.
was (Author: lukyer):
I need to figure out how exactly teiid makes columns' data type mapping in SQL syntax: "CREATE VIEW x AS SELECT a,b,c ..." because if I am forced to use SQL syntax: "CREATE VIEW (a integer, b varchar, c integer) AS SELECT a,b,c ..." I do have to do this mapping manually in my code. I want to avoid this.
Of course I can get some information from table's information schema (source data types) but I have to figure out how to map them into TEIID's data types for VIEW usage.
> RETURN_GENERATED_KEYS not working
> ---------------------------------
>
> Key: TEIID-5397
> URL: https://issues.jboss.org/browse/TEIID-5397
> Project: Teiid
> Issue Type: Bug
> Affects Versions: 10.2.1
> Reporter: Lukáš Svačina
> Assignee: Steven Hawkins
>
> *+VDB:+*
> {code}
> <vdb name="_GENERATED_form_shoes" version="2">
> <model name="_INTERNAL_internalModel" type="PHYSICAL">
> <source name="internal_postgresql" translator-name="postgresql" connection-jndi-name="java:/internal"/>
> </model>
> <model name="GEN_view" type="VIRTUAL">
> <metadata type="DDL">
> <![CDATA[ CREATE VIEW "_view_workflow_data" OPTIONS (UPDATABLE 'true')
> AS SELECT "public"."form_shoes_2"."size" AS "size", "public"."form_shoes_2"."model" AS "model",
> "public"."form_shoes_2"."id" AS "id" FROM "public"."form_shoes_2" ]]>
> </metadata>
> </model>
> </vdb>
> {code}
> *+TABLE:+*
> name: form_shoes_2
> columns: id (SERIAL) | size (INTEGER *NULLABLE*) | model (VARCHAR *NULLABLE*)
> *+PROBLEM:+*
> Connected into VDB using JDBC like:
> {code:java}
> final PreparedStatement statement = c.prepareStatement(...INSERT..., Statement.RETURN_GENERATED_KEYS);
> statement.executeUpdate();
> final ResultSet generatedKeys = statement.getGeneratedKeys();
> {code}
> *generatedKeys is empty if:*
> # INSERT INTO "form_shoes_2" ( "model" ) VALUES ( 'adidas x1' ) ...... e.g. not all columns are enumerated ... if so, you can provide NULL values to optional columns and generated keys WORK!
> # INSERT INTO "_view_workflow_data" (id, name, size) VALUES (42, 'adidas x2', 12 ) ....... e.g. insering into view (1:1, no joins involved) even when all columns ARE enumerated ... probably no way how to get generated keys here?
> *+QUESTIONS:+*
> # How to get last_insert_id() when inserting into foreign table/views (with/without joins)?
> # How to get updated rows (UPDATE ... RETURNING *)? At least primary keys of affected rows?
> Thanks for fixing/adding this functionality.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 5 months
[JBoss JIRA] (TEIID-5397) RETURN_GENERATED_KEYS not working
by Lukáš Svačina (JIRA)
[ https://issues.jboss.org/browse/TEIID-5397?page=com.atlassian.jira.plugin... ]
Lukáš Svačina commented on TEIID-5397:
--------------------------------------
I need to figure out how exactly teiid makes columns' data type mapping in SQL syntax: "CREATE VIEW x AS SELECT a,b,c ..." because if I am forced to use SQL syntax: "CREATE VIEW (a integer, b varchar, c integer) AS SELECT a,b,c ..." I do have to do this mapping manually in my code. I want to avoid this.
Of course I can get some information from table's information schema (source data types) but I have to figure out how to map them into TEIID's data types for VIEW usage.
> RETURN_GENERATED_KEYS not working
> ---------------------------------
>
> Key: TEIID-5397
> URL: https://issues.jboss.org/browse/TEIID-5397
> Project: Teiid
> Issue Type: Bug
> Affects Versions: 10.2.1
> Reporter: Lukáš Svačina
> Assignee: Steven Hawkins
>
> *+VDB:+*
> {code}
> <vdb name="_GENERATED_form_shoes" version="2">
> <model name="_INTERNAL_internalModel" type="PHYSICAL">
> <source name="internal_postgresql" translator-name="postgresql" connection-jndi-name="java:/internal"/>
> </model>
> <model name="GEN_view" type="VIRTUAL">
> <metadata type="DDL">
> <![CDATA[ CREATE VIEW "_view_workflow_data" OPTIONS (UPDATABLE 'true')
> AS SELECT "public"."form_shoes_2"."size" AS "size", "public"."form_shoes_2"."model" AS "model",
> "public"."form_shoes_2"."id" AS "id" FROM "public"."form_shoes_2" ]]>
> </metadata>
> </model>
> </vdb>
> {code}
> *+TABLE:+*
> name: form_shoes_2
> columns: id (SERIAL) | size (INTEGER *NULLABLE*) | model (VARCHAR *NULLABLE*)
> *+PROBLEM:+*
> Connected into VDB using JDBC like:
> {code:java}
> final PreparedStatement statement = c.prepareStatement(...INSERT..., Statement.RETURN_GENERATED_KEYS);
> statement.executeUpdate();
> final ResultSet generatedKeys = statement.getGeneratedKeys();
> {code}
> *generatedKeys is empty if:*
> # INSERT INTO "form_shoes_2" ( "model" ) VALUES ( 'adidas x1' ) ...... e.g. not all columns are enumerated ... if so, you can provide NULL values to optional columns and generated keys WORK!
> # INSERT INTO "_view_workflow_data" (id, name, size) VALUES (42, 'adidas x2', 12 ) ....... e.g. insering into view (1:1, no joins involved) even when all columns ARE enumerated ... probably no way how to get generated keys here?
> *+QUESTIONS:+*
> # How to get last_insert_id() when inserting into foreign table/views (with/without joins)?
> # How to get updated rows (UPDATE ... RETURNING *)? At least primary keys of affected rows?
> Thanks for fixing/adding this functionality.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 5 months
[JBoss JIRA] (TEIID-5397) RETURN_GENERATED_KEYS not working
by Ramesh Reddy (JIRA)
[ https://issues.jboss.org/browse/TEIID-5397?page=com.atlassian.jira.plugin... ]
Ramesh Reddy commented on TEIID-5397:
-------------------------------------
I do not follow what you are suggesting, do you have links from Postgresql how it does it?
> RETURN_GENERATED_KEYS not working
> ---------------------------------
>
> Key: TEIID-5397
> URL: https://issues.jboss.org/browse/TEIID-5397
> Project: Teiid
> Issue Type: Bug
> Affects Versions: 10.2.1
> Reporter: Lukáš Svačina
> Assignee: Steven Hawkins
>
> *+VDB:+*
> {code}
> <vdb name="_GENERATED_form_shoes" version="2">
> <model name="_INTERNAL_internalModel" type="PHYSICAL">
> <source name="internal_postgresql" translator-name="postgresql" connection-jndi-name="java:/internal"/>
> </model>
> <model name="GEN_view" type="VIRTUAL">
> <metadata type="DDL">
> <![CDATA[ CREATE VIEW "_view_workflow_data" OPTIONS (UPDATABLE 'true')
> AS SELECT "public"."form_shoes_2"."size" AS "size", "public"."form_shoes_2"."model" AS "model",
> "public"."form_shoes_2"."id" AS "id" FROM "public"."form_shoes_2" ]]>
> </metadata>
> </model>
> </vdb>
> {code}
> *+TABLE:+*
> name: form_shoes_2
> columns: id (SERIAL) | size (INTEGER *NULLABLE*) | model (VARCHAR *NULLABLE*)
> *+PROBLEM:+*
> Connected into VDB using JDBC like:
> {code:java}
> final PreparedStatement statement = c.prepareStatement(...INSERT..., Statement.RETURN_GENERATED_KEYS);
> statement.executeUpdate();
> final ResultSet generatedKeys = statement.getGeneratedKeys();
> {code}
> *generatedKeys is empty if:*
> # INSERT INTO "form_shoes_2" ( "model" ) VALUES ( 'adidas x1' ) ...... e.g. not all columns are enumerated ... if so, you can provide NULL values to optional columns and generated keys WORK!
> # INSERT INTO "_view_workflow_data" (id, name, size) VALUES (42, 'adidas x2', 12 ) ....... e.g. insering into view (1:1, no joins involved) even when all columns ARE enumerated ... probably no way how to get generated keys here?
> *+QUESTIONS:+*
> # How to get last_insert_id() when inserting into foreign table/views (with/without joins)?
> # How to get updated rows (UPDATE ... RETURNING *)? At least primary keys of affected rows?
> Thanks for fixing/adding this functionality.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 5 months