Issue with InvokeQuery; Keyword not supported: filename (Parameter 'keyword')

Running this script:

(Invoke-PostgreSqlQuery -ConnectionString $ConnectionString -Sql “select CustomerSystem from customer_e1systems”).CustomerSystem

Causes the following error:
Keyword not supported: filename (Parameter ‘keyword’)

It works fine run as a script in VSCode.

Any help very much appreciated.


I think you are running into a conflict with variables. The $ConnectionString variable is populated and contains the connection string to the PSU database.

Can you try changing that variable to something else? Like $PGConnectionString.

Thanks for the quick reply :slight_smile:

$PGConnectionString = “Server=localhost;Port=5432;database=‘e1conductordb’;”

Works if it’s defined in the script itself, but if I only define in vairables.ps1 then I get:

[error] Keyword not supported: data source (Parameter ‘keyword’)

Can you share how you defined it? I just tried this myself and it works fine.

Here’s my variables.ps1.

New-PSUVariable -Name "PGConnectionString" -Value "My Connection String"