Re: Errors when restoring backup created by pg_dumpall

2024-12-10 Thread PopeRigby

On 12/9/24 16:31, Adrian Klaver wrote:

On 12/9/24 15:30, PopeRigby wrote:

On 12/9/24 15:23, Tom Lane wrote:

Adrian Klaver  writes:

You could file an issue here:
https://www.postgresql.org/account/login/?next=/account/submitbug/
Ask if the developers could use the mechanisms available here:
https://www.postgresql.org/docs/current/extend-extensions.html#EXTEND-EXTENSIONS-RELOCATION 


This wouldn't really move the needle, since (a) there is not some
magic group of people that will become involved who aren't already
and (b) the requested fix seems exactly the same as the work
already in progress at [1].

What would help is to figure out why the proposed patch didn't
seem to work for you.  I continue to suspect that you didn't
really install the updated extension, but it's unclear.

    regards, tom lane

[1] 
https://www.postgresql.org/message-id/flat/3395418.1618352...@sss.pgh.pa.us


I compiled and installed PostgreSQL with the patch, and restarted it, 
so unless there are other steps I'm not sure what I could have done 
wrong.





What was the source of the patch?

This: 
https://www.postgresql.org/message-id/attachment/122092/0002-earthdistance-sql-functions.patch






Clusters and shared permissions using LDAP

2024-12-10 Thread Felipe Matas
Hi all! I'm trying to build three postgres clusters (in different servers), I'm 
thinking to use CITUS to make the data available across the clusters, I'm 
checking the docs.
What I have not been able to found in any place, is how to handle the 
permissions, I can use LDAP to handle the shared credentials across the 
clusters, I have not experience with LDAP but is no problem with learning :)
So, how can I handle the permissions? From what I have read, seems LDAP only 
handle user/pass, is there any way to make all the clusters to have the same 
permissions to the LDAP users?
In the time, I'll add more servers to this, so handle server by server all the 
permissions to each user is not a nice way to handle it.
Probs this is already solved somehow, but I can't find it.
Thx!


Formulating SQL queries via Retrieval Augmented Generation (RAG).

2024-12-10 Thread Allan Kamau
I am not sure if this is the right place to post a PostgreSQL + Retrieval
Augmented Generation (RAG) question, but I have tried other sites but I did
not receive any response.

I have managed to use RAG to query data in a PostgreSQL table using Python
and the lanchain_community module.

But I have been struggling for weeks trying to find a solution to using RAG
to perform WITH RECURSIVE CTE on two tables (modeling node and edge graph
data).
The SQL queries generated by RAG for this graph data model are error prone.
Is there an example somewhere where RAG has been used to successfully
generate WITH RECURSIVE CTE on two table graph data?

Below is the main code section I am using to perform RAG on PostgreSQL.

llm = ChatGroq(model="mixtral-8x7b-32768", temperature=0);

chain = (
RunnablePassthrough.assign(query=sql_chain).assign(
schema=lambda _: db.get_table_info(),
response=lambda vars: db.run(vars["query"]),
)
| prompt
| llm
)
response_obj: langchain_core.messages.ai.AIMessage=chain.invoke({
"question": user_query_str,
"chat_history": chat_history_list,
});



Any pointers are welcome.

-Allan


Re: Errors when restoring backup created by pg_dumpall

2024-12-10 Thread Adrian Klaver

On 12/10/24 19:05, PopeRigby wrote:

On 12/9/24 16:31, Adrian Klaver wrote:

On 12/9/24 15:30, PopeRigby wrote:

On 12/9/24 15:23, Tom Lane wrote:

Adrian Klaver  writes:

You could file an issue here:
https://www.postgresql.org/account/login/?next=/account/submitbug/
Ask if the developers could use the mechanisms available here:
https://www.postgresql.org/docs/current/extend-extensions.html#EXTEND-EXTENSIONS-RELOCATION

This wouldn't really move the needle, since (a) there is not some
magic group of people that will become involved who aren't already
and (b) the requested fix seems exactly the same as the work
already in progress at [1].

What would help is to figure out why the proposed patch didn't
seem to work for you.  I continue to suspect that you didn't
really install the updated extension, but it's unclear.

    regards, tom lane

[1] 
https://www.postgresql.org/message-id/flat/3395418.1618352...@sss.pgh.pa.us


I compiled and installed PostgreSQL with the patch, and restarted it, 
so unless there are other steps I'm not sure what I could have done 
wrong.





What was the source of the patch?

This: 
https://www.postgresql.org/message-id/attachment/122092/0002-earthdistance-sql-functions.patch




If I am following correctly I believe you need this one:

https://www.postgresql.org/message-id/attachment/166859/v2-0002-Use-new-style-SQL-function-in-earthdistance-exten.patch

It has the changes that include the schema qualifications. The one you 
used does not have those modifications.


--
Adrian Klaver
adrian.kla...@aklaver.com