Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SqlUtil: cop_seq and cop_seq_currval not implemented #624

Closed
pavelkveton opened this issue Mar 17, 2016 · 0 comments
Closed

SqlUtil: cop_seq and cop_seq_currval not implemented #624

pavelkveton opened this issue Mar 17, 2016 · 0 comments
Assignees
Milestone

Comments

@pavelkveton
Copy link
Contributor

just tried to use cop_seq in select (see the attached file), and it is not working at all.

The review of SqlUtil says that cop_seq is created with make_cop, which means it results in a hash

(
"cop" : "seq",
"column" : "<sequence_name>", # !!! mind the column key here
)

as such, it wents down to SqlUtil.qm line 11359, where doColumnOperatorIntern is called (with the aforementioned hash as the 1st arg). I.e. the overload of doColumnOperatorIntern on line 11627 is called, where one of the parameters passed down is

(cvc.column ? getColumnExpressionIntern(cvc.column, jch, join, ch) : NOTHING)

since "column" is filled with the sequence name, getColumnExpressionIntern is really called, assuming its argument is a column name, and produces an exception (you can try yourself with the attached file).

I'd say the "column" key is bad here and should be renamed, but still, IF it is modified, it would throw a few lines below (11637), where it would find out that "seq" is missing from DefaultCopMap (as well as other operators).

So I took a suspicion that cop_seq cannot work at all, and voila - it is really not used anywhere in the rossini code.

zk.q:

%new-style
%requires SqlUtil

DatasourcePool dsstage("pgsql:staging/staging@staging");
on_success dsstage.commit();
on_error dsstage.rollback();

SqlUtil::Table t(dsstage, "h3g_it_aruba_emails_iface");
t.select(("columns" : (
cop_seq("h3g_it_transaction_id_s"),
#"target_system",
#"source_system",
#cop_value("IT_OIC_INV_MAIL_FDB"),
#cop_value("I"),
#11,
#12,
#"message_id",
#cop_value("Success"),
#cop_value("2016-01-01"),
#"pec_sender",
#"pec_sender_pwd",
),
"where" : (
"i_sepl_updated_id" : 10,
"message_type" : "IT_OIC_MAIL",
"message_id" : "1",)));

davidnich added a commit that referenced this issue Mar 19, 2016
…guments to those functions for specifying the column alias, added the "withalias" column option flag to allow for column operators to more easily define column aliases, added tests & updated relnotes
tethal added a commit that referenced this issue Mar 19, 2016
refs #624 fixed cop_seq() and cop_seq_currval(), added convenience ar…
@tethal tethal added the fixed label Mar 19, 2016
@tethal tethal closed this as completed Mar 19, 2016
@davidnich davidnich added this to the 0.8.12 milestone Feb 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants