write an example hello world c postgres extension
- User
write an example hello world c postgres extension
Assistant
Here is an example of a "Hello, World!" C Postgres extension:
#include "postgres.h" #include "fmgr.h" PG_MODULE_MAGIC; PG_FUNCTION_INFO_V1(hello_world); Datum hello_world(PG_FUNCTION_ARGS) { PG_RETURN_TEXT_P(cstring_to_text(pstrdup(PG_FUNCTION_ARGS, "Hello, World!"))); }This extension defines a single function called
hello_worldthat returns the string "Hello, World!". To use this function in a Postgres query, you would first need to build and install the extension, and then you could call the function like this:SELECT hello_world();This would return the text "Hello, World!" as a result.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.