LibreOffice Base Execute Stored Procedure/Function - postgresql

I'm busy setting up a odb file with LibreOffice Base to be used with LibreOffice Calc. The odb file is working fine I can create and save regular queries but it is giving an error when I try to execute a Stored Procedure/Function. When using pgAdmin I can execute the call just fine
select * from funcProduction(current_date, current_date);
This works and returns the data expected but when I try in LibreCalc Base using Queries > Create Query in SQL View, executing the exact same call to the Stored Procedure/Function it fails with an error
Syntax error in SQL statement
I'm not sure why there's an error or even where to find what the error is

Set the query to Run SQL command directly. This is best for any engine except HSQLDB 1.8.
Related:
https://ask.libreoffice.org/en/question/133467/base-andor-syntax-w-mysql/?answer=133476#post-id-133476
sql dialect in OpenOffice Base
https://superuser.com/a/899223/541756

Related

How to create multiple databases with Postgres in pgAdmin4

I am trying to run the following query in pgAdmin:
CREATE DATABASE abc;
CREATE DATABASE xyz;
And I get the following error:
ERROR: current transaction is aborted, commands ignored until end of transaction block
SQL state: 25P02
I'm relatively new to postgres.
With SQL Server it's possible to create multiple databases in a single query with the "GO" statement in between if necessary.
I've tried to google this error, and most answers are to simply run each line separately.
That would work, but I'm curious why this doesn't work.
It may also be a setting in pgAdmin.
The "autocommit" is currently on. I've tried it off, and same result.
I'm using postgres 14.5 (in aws)

Install4j - Is it possible to run TSQL queries?

When working with Server-Sql, sometimes it needs to use Transact-SQL queries. Is it possible to execute it through Install4j?
EDIT
I'm using the Server SQL JDBC driver: - com.microsoft.sqlserver.jdbc.SQLServerDriver.
When I'm trying to execute the following script in the SSMS it works without any problem:
USE [${installer:DbName}]
GO
CREATE USER [Guest] FOR LOGIN [Guest]
GO
USE [${installer:acDbName}]
GO
ALTER ROLE [db_owner] ADD MEMBER [Guest]
GO
, but when executing it with the "Execute SQL script" I get the following error: com.install4j.runtime.beans.actions.jdbc.ExecuteSqlScriptAction [ID 8123]: Error executing script line "U", error message: "Could not find stored procedure 'U'."
When enabling the statement delimeter with ; I'm getting the next error:
"Incorrect syntax near 'GO'."
It depends on whether the JDBC driver that you are using can handle TSQL or not, install4j does not have support for specific databases.

ERROR: current transaction is aborted, commands ignored until end of transaction block --- export data from Aqua studio

I am trying to export one table from Aquastudio into CSV file. The table has approximately 4.4 million rows. When I am trying to use the export window function in the aqua studio, I am facing the following error:
Error: ERROR: current transaction is aborted, commands ignored until end of transaction block
I am not understanding what the problem is. I read few articles regarding this error and found that this is happening due to some error in the last postgreSQL command. I did not use any SQL commands for this export and I dont know how to debug this. I am also unable to view the log files.
Use rollback to cancel the previous query. After that, you will be able to execute your current query.
You probably shouldn't be exporting millions of rows through a JDBC/ODBC connection, especially for Redshift.
For Redshift, please use the UNLOAD command documented here. You'll have to UNLOAD the file to S3 and download it from there.
For Postgres, use COPY TO as documented here.

using executable in Liquibase changesets

I am using execute command tag from my liquibase changesets and this inturn is configured to run the sqls in oracle instant client sql plus.
when i run a liquibase update on my changelogxml everything works fine and the liquibase update is sucessfull.I can see the changes to the table also.
But when i try to fail the update process by giving a syntax error in my sql file refered in the changeset.Liquibase still returns liquibase update sucessfull.I expected it to throw sql errors.The sql when run seperately in toad throws syntax error.What should i do to get the error displayed out.?
Datical has created a custom Liquibase change tag that executes SQL using the sqlplus command line client. It was surprisingly much more complicated that you might think.
Some of the issues we had to deal with:
we had to do things to ensure that the sql files always had certain statements in place, and never had certain other statements. This might include things like setting the schema, ensuring that the only spool commands were ones we knew about, that the script had an 'EXIT' command, and ensuring that whenever there was a SQL error that the exit code was returned.
The sqlplus executable does not return an exit code (i.e. a non-zero exit code form the native process) in all cases, and instead will write errors to an error table in the database. The table where sqlplus writes errors is called sperrorlog, and this may be what you will need to look into.
I can't really go into all the details, but just know that what you are attempting to do is neither simple nor straightforward.

passing parameter value through pgoledb to postgresql stored function

I am attempting to migrate a legacy client-server GIS application from Microsoft SQL Server to PostgreSQL. In this system the SQL Server database contains a large set of T-SQL stored procedures, each being an SQL Select query with one or more parameters.
In response to a client request, the server program – classic ASP VBScript – uses Microsoft ADODB to fill in the parameters values, execute the requested query and return the result set as an XML document to the client.
In the preliminary phase of the migration I have successfully:
installed PostgreSQL 9.3 for Windows, PgOleDB 1.0.0.20 and psqlODBC on a 32.bit Windows 7 Pro development PC
migrated the SQL Server database table definitions and constraint to a new PostgreSQL database and populated the tables using psqlODBC
using pgAdmin III, created and executed test queries against the PostgreSQL database
using pgAdmin III, created two test PostgreSQL table-valued Select functions – test1() one with no parameters and test2(text) with a single IN parameter — and verified that both execute correctly
written a test ASP/VBscript program that uses ADODB.Connection and ADODB.Command to connect to the PostgreSQL database, execute test1() - the no-parameter stored function - and create an ADODB.Recordset. This test works correctly.
However when I change my test ASP/VBscript program to use test2() and use objCmd.Parameters.Append like this:
objCmd.CommandText = "test2"
objCmd.Parameters.Append objCmd.CreateParameter("p1", adVarChar, adParamInput, 15, "000007-01012013")
to specify the required IN parameter, I get the ASP runtime error:
PgOleDB error '80004005' “Procedure name for automatic arguments is not unique“
Q1. What does the diagnostic “Procedure name for automatic arguments is not unique” mean?
Q2. Is there any public documentation available for PgOleDB other than the README.TXT and RELEASENOTES.TXT files installed along with PgOleDB.dll?