Skip to content
TheChatArchiveThe Chat Archive
DeepSeekdeepseek-llm-67b-chat· DeepSeekHugging Face Arena Human Preference 55K

write an example hello world c postgres extension

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with gpt-4-1106-preview’s answer.
  1. User

    write an example hello world c postgres extension

  2. DeepSeek 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_world that 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.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.