Search code examples
c#postgresqlnpgsql

Get database list in Npgsql


How can I get a list of all available PostgreSQL databases on a user's computer using Npgsql in C#?


Solution

  • In postgreSQL there are two way to do it :

    • \l
    • SELECT datname FROM pg_database;