pg.ddx.io pgsql-docs@postgresql.org mailing list archive
help / color / mirror / Atom feeddoc-fix-for-POSIX-Time-Zone-Specifications
2+ messages / 2 participants
[nested] [flat]
* doc-fix-for-POSIX-Time-Zone-Specifications
@ 2021-05-17 11:36 tanghy.fnst@fujitsu.com <tanghy.fnst@fujitsu.com>
0 siblings, 0 replies; 2+ messages in thread
From: tanghy.fnst@fujitsu.com @ 2021-05-17 11:36 UTC (permalink / raw)
To: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
Hi
Attached a patch to delete "CURRENT(as of 2020) " description in POSIX Time Zone Specifications.
I'm not a native English speaker, if my fix is not appropriate or insufficient, please be kind to share your thought with me.
Regards,
Tang
Attachments:
[application/octet-stream] 0001-doc-fix-for-POSIX-Time-Zone-Specifications.patch (870B, ../../OS0PR01MB6113393560A1DF115ADFB153FB2D9@OS0PR01MB6113.jpnprd01.prod.outlook.com/2-0001-doc-fix-for-POSIX-Time-Zone-Specifications.patch)
download | inline diff:
From b975e516d4d0e178ade8a66449f643885ce5fa9e Mon Sep 17 00:00:00 2001
From: tanghy <tanghy.fnst@fujitsu.com>
Date: Fri, 14 May 2021 22:50:28 +0900
Subject: [PATCH] doc fix for POSIX Time Zone Specifications
diff --git a/doc/src/sgml/datetime.sgml b/doc/src/sgml/datetime.sgml
index c53bd2f379..1295bc60ad 100644
--- a/doc/src/sgml/datetime.sgml
+++ b/doc/src/sgml/datetime.sgml
@@ -728,7 +728,7 @@
<para>
As an example, <literal>CET-1CEST,M3.5.0,M10.5.0/3</literal> describes
- current (as of 2020) timekeeping practice in Paris. This specification
+ timekeeping practice as of 2020 in Paris. This specification
says that standard time has the abbreviation <literal>CET</literal> and
is one hour ahead (east) of UTC; daylight savings time has the
abbreviation <literal>CEST</literal> and is implicitly two hours ahead
--
2.30.0.windows.2
^ permalink raw reply [nested|flat] 2+ messages in thread
* Creation of extensions and Backend C/C++ functions.
@ 2024-11-25 16:11 PG Doc comments form <noreply@postgresql.org>
0 siblings, 0 replies; 2+ messages in thread
From: PG Doc comments form @ 2024-11-25 16:11 UTC (permalink / raw)
To: pgsql-docs@lists.postgresql.org; +Cc: tconorkerrigan@gmail.com
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/17/xfunc-c.html
Description:
I can and have implemented triivial C/C++ functions to compile and link to
Postgres. An example follows:-
#include "postgres.h"
#include "fmgr.h"
#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif
/* Function declaration */
PG_FUNCTION_INFO_V1(always_true);
/* The function alwaysTrue() - returns true */
Datum
always_true(PG_FUNCTION_ARGS)
{
PG_RETURN_BOOL(true);
}
PG_FUNCTION_INFO_V1(is_WIN32);
Datum
is_WIN32(PG_FUNCTION_ARGS)
{
bool result = false;
#ifdef WIN32
result = true;
#endif
PG_RETURN_BOOL(result);
}
This compiles and is linked as follows:-
cc -fPIC -IC:/msys64/mingw64/include/POSTGR~1/server -shared -o ext.dll *.c
-I/mingw64/include/POSTGR~1
cp ext.dll C:/msys64/mingw64/lib/POSTGR~1/.
(from pg_config --pkglibdir
C:/msys64/mingw64/lib/POSTGR~1)
I use pgAdmin to create or replace functions .... They work correctly.
The problem I have arises when I try to add a non trivial function for my
app. The function is :-
PG_FUNCTION_INFO_V1(set_balance_with_id);
Datum set_balance_with_id(PG_FUNCTION_ARGS) {
int32 arg0 = PG_GETARG_INT32(0);
bool arg1 = PG_GETARG_BOOL(1);
bool result = set_balance_with_id_cpp (arg0, arg1, 0.00f);
PG_RETURN_BOOL(result);
}
The function set_balance_with_id_cpp is defined in a wrapper thus:-
#include "LedgerOrAccount.h"
#include "LedgerOrAccountWrapper.h"
#include <iostream>
// Define the C-compatible wrapper functions
// Implement the C-compatible wrapper functions
//extern "C" {
// Define the C++ wrapper function for PostgreSQL
bool set_balance_with_id_cpp(int id, bool debit, double balance) {
double new_balance = 0.00f;
try {
// Create an instance of the LedgerOrAccount class
LedgerOrAccount ledger(id);
TransactionType transactionType = debit? DEBIT: CREDIT;
// Call the setBalance method on the class
new_balance = ledger.setBalance(balance, transactionType);
} catch (const std::exception& e) {
std::cerr << "set_balance_with_id_cpp -> " << e.what() <<
std::endl;
}
// Return true if balance is set successfully
return (new_balance >= 0.00f);
}
Now I can compile the function into a shared library but when I try to load
it, postgres cannot do so. pgAdmin:->
DEBUG: StartTransaction(1) name: unnamed; blockState: DEFAULT; state:
INPROGRESS, xid/subid/cid: 0/1/0
LOG: statement: LOAD 'my_extension';
DEBUG: find_in_dynamic_libpath: trying "C:/Program
Files/PostgreSQL/17/lib/my_extension"
DEBUG: mapped win32 error code 2 to 2
DEBUG: mapped win32 error code 2 to 2
DEBUG: find_in_dynamic_libpath: trying
"C:/msys64/mingw64/lib/POSTGR~1/my_extension"
DEBUG: mapped win32 error code 2 to 2
DEBUG: mapped win32 error code 2 to 2
DEBUG: find_in_dynamic_libpath: trying
"C:/mysys64/mingw64/lib/my_extension"
DEBUG: mapped win32 error code 3 to 2
DEBUG: mapped win32 error code 3 to 2
DEBUG: find_in_dynamic_libpath: trying "C:/Program
Files/PostgreSQL/17/lib/my_extension.dll"
DEBUG: mapped win32 error code 2 to 2
DEBUG: mapped win32 error code 2 to 2
DEBUG: find_in_dynamic_libpath: trying
"C:/msys64/mingw64/lib/POSTGR~1/my_extension.dll"
ERROR: could not load library
"C:/msys64/mingw64/lib/POSTGR~1/my_extension.dll": The specified module
could not be found.
SQL state: 58P01
And in pgAdmin :-
-- Load the shared library if not already loaded
CREATE FUNCTION set_balance_with_id(int, double precision, boolean)
RETURNS boolean
AS 'my_extension', 'set_balance_with_id'
LANGUAGE c STRICT;
and identically, pgAdmin ->
DEBUG: StartTransaction(1) name: unnamed; blockState: DEFAULT; state:
INPROGRESS, xid/subid/cid: 0/1/0
LOG: statement: -- Load the shared library if not already loaded
CREATE FUNCTION set_balance_with_id(int, double precision, boolean)
RETURNS boolean
AS 'my_extension', 'set_balance_with_id'
LANGUAGE c STRICT;
DEBUG: find_in_dynamic_libpath: trying "C:/Program
Files/PostgreSQL/17/lib/my_extension"
DEBUG: mapped win32 error code 2 to 2
DEBUG: mapped win32 error code 2 to 2
DEBUG: find_in_dynamic_libpath: trying
"C:/msys64/mingw64/lib/POSTGR~1/my_extension"
DEBUG: mapped win32 error code 2 to 2
DEBUG: mapped win32 error code 2 to 2
DEBUG: find_in_dynamic_libpath: trying
"C:/mysys64/mingw64/lib/my_extension"
DEBUG: mapped win32 error code 3 to 2
DEBUG: mapped win32 error code 3 to 2
DEBUG: find_in_dynamic_libpath: trying "C:/Program
Files/PostgreSQL/17/lib/my_extension.dll"
DEBUG: mapped win32 error code 2 to 2
DEBUG: mapped win32 error code 2 to 2
DEBUG: find_in_dynamic_libpath: trying
"C:/msys64/mingw64/lib/POSTGR~1/my_extension.dll"
ERROR: could not load library
"C:/msys64/mingw64/lib/POSTGR~1/my_extension.dll": The specified module
could not be found.
SQL state: 58P01
my_extension is in the latter dir.
Can you offer any advice or help to fix this issue?
Thank you in advance,
Conor
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2024-11-25 16:11 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17 11:36 doc-fix-for-POSIX-Time-Zone-Specifications tanghy.fnst@fujitsu.com <tanghy.fnst@fujitsu.com>
2024-11-25 16:11 Creation of extensions and Backend C/C++ functions. PG Doc comments form <noreply@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox