RLS not working when connecting using Database connection string with Drizzle ORM

I have this connection.ts
const connectionString = serverEnv.SUPABASE_DATABASE_URL;

const pool = postgres(connectionString, { max: 1 });
export const connection = pool;
export const db: PostgresJsDatabase<typeof schema> = drizzle(pool, { schema });

(async () => {
  try {
    const result = await pool`
      SELECT current_user, session_user, inet_client_addr(), rolname, rolsuper, rolreplication, rolbypassrls 
      FROM pg_roles 
      WHERE rolname = current_user;
    `;
    console.log("DB connection user info:", result[0]);
  } catch (err) {
    console.error("Failed to query user info:", err);
  }
})();

It outputs the user details that is used to connect to the database. It has current_user: 'postgres', rolname: 'postgres', rolbypassrls: true. How can i connect using some other user that respects RLS policies?
Was this page helpful?