PowerShell 7: CREATE table works, SELECT table doesnt
Works fine in Windows PowerShell 5, doesnt work in 7
Works: CREATE table Customers Doesnt work: SELECT * from Customers
InvalidOperation:
Hi!
Yes, the default of As PSObject will not work outside of Windows PowerShell.
Don't have time to fix this (e.g. change default for *nix), but as a workaround, switch -As to something else:
[ValidateSet("DataSet", "DataTable", "DataRow","PSObject","SingleValue")]
[string]
$As="PSObject"
Presumably -as DataRow
Thanks!
Hm, I'm sure I fixed this originally when adding core support... Though I changed a lot since then. I will try take another look at this some time this week if I can.
@slashd can you confirm what OS you are running pwsh 7 on? If it is windows, I have a feeling I know what the problem is...
Thanks
@slashd I have tried this on both linux and windows with PowerShell 7 and have been unable to replicate this issue.
I believe I fixed this in core by reimplementing the [DBNullScrubber] under this commit: https://github.com/RamblingCookieMonster/PSSQLite/commit/095b70138134bc20f633163272865962cd6c6bd6
I do not have a mac available to test in case the issue was on that platform.
If you are still having this issue, please provide details on your PS version, OS and PSSqlite module version.
@RamblingCookieMonster May want to consider closing this if there is no follow up?
My test:
PSSQLite> $d = { datasource = "./test.db" }
PSSQLite> Invoke-SqliteQuery @d -Query "create table customer (name)"
PSSQLite> Invoke-SqliteQuery @d -Query "insert into customer (name) values ('bob')"
PSSQLite> Invoke-SqliteQuery @d -Query "select * from customer"
name
----
bob
Works for Invoke-SqlCmd2 as well. Thank you, fffnite for taking the time to troubleshoot this for the community.