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

Invoke-SqliteQuery Fails when there is Rank() used in views #29

Open
manikandancr opened this issue Jun 16, 2020 · 4 comments · May be fixed by #30
Open

Invoke-SqliteQuery Fails when there is Rank() used in views #29

manikandancr opened this issue Jun 16, 2020 · 4 comments · May be fixed by #30

Comments

@manikandancr
Copy link

Invoke-SqliteQuery is failing if we have used Rank(), or in fact any analytic function in view queries. Below is the error that I am getting.

"database disk image is malformed
malformed database schema (UserCommentsSummary) - near "(": syntax error"
At line:24 char:16"

@bgwdotdev
Copy link
Contributor

Hi @manikandancr

Would you be able to provide further details or a method of recreating this issue? I have tried with the following code and did not experience problems but I may be misunderstanding your problem.

$d = @{datasource = './test.db'}
Invoke-SqliteQuery @d -Query "create table rankdemo ( val text )"
Invoke-SqliteQuery @d -Query "Insert into rankdemo(val) values('a'),('b'),('c')"
Invoke-SqliteQuery @d -Query "create view rankview as select val, rank() over ( order by val ) valrank from rankdemo"
Invoke-SqliteQuery @d -Query "select * from rankview"

val valrank
--- -------
a         1
b         2
c         3

@manikandancr
Copy link
Author

manikandancr commented Aug 19, 2020

Hi @fffnite

The above script is failing for me at create view session. Please find the screenshot below,

image

@bgwdotdev
Copy link
Contributor

Ah, I see the problem now. I only updated PS Core to the new sqlite .dll so when using PS5 you are loading the old binaries which, I assume, don't support the rank function.

I will write a patch for this now though it may take a little bit to get merged into master as RCM is a busy individual.

@manikandancr You can either pull my repo once I reference the patch or if you can, you can use PS Core instead of PS5

@bgwdotdev bgwdotdev linked a pull request Aug 19, 2020 that will close this issue
@manikandancr
Copy link
Author

Hi @fffnite ,

The issue seems to resolved after using the modified .psm1 script. But still facing an issue in another machine which is running windows server 2012 R2 with the below powershell version .

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants