Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJUJa-005Aaq-KF for pgsql-general@arkaria.postgresql.org; Tue, 18 Jun 2024 08:35:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sJUJX-009pam-Ak for pgsql-general@arkaria.postgresql.org; Tue, 18 Jun 2024 08:35:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJUJW-009pYj-Vy for pgsql-general@lists.postgresql.org; Tue, 18 Jun 2024 08:35:39 +0000 Received: from mail-oa1-x31.google.com ([2001:4860:4864:20::31]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sJUJR-001soi-7a for pgsql-general@lists.postgresql.org; Tue, 18 Jun 2024 08:35:38 +0000 Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-2598a57b2c1so31382fac.0 for ; Tue, 18 Jun 2024 01:35:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718699732; x=1719304532; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=M7kALEkZHjEPzqr/BiVEunqy9OqlYOSZDRpH/Yt/mJc=; b=GBoUM4K6MCr/R6bATK0VcPetVetNscogAu76jYr6QTRrjs7ZNWdCOVeGrqukuy2SyW 9y+1vi2/iKmxCmrV//FemXHX6AONzQo01KdN7D8CnuF1w6FtbUlt27PuEf7krZm5Voj1 j7Ur8mDF7brIcx4ZzIR2y0hh3DDe7HYjBgX+zCkhVLCCEqIGF6bpSOsxGAQxzrZmxRy8 Ofo6aPg9AVJ31KGnEwmnaC9F0HJXkRIOz5HkvtWNLZ39OqghMiW1NCbjGglkW1r0W9On M1StiIVdCCMTgQACFcM4sHxY2TWGXnaJzOO+tCT2mPE51mtCyf5FohBWL26Trn5hlUdo 61Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718699732; x=1719304532; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=M7kALEkZHjEPzqr/BiVEunqy9OqlYOSZDRpH/Yt/mJc=; b=jWYVGTFtJFCTrowo7SQEosKMOTn8FlDF5Fz4Rl+Knor3y+Ywp5M8dlRVUl2w7qKyi+ flEWCHQjrJx+ytQ36tko6heaaai6omcD4hUwEs7kVLp+lWTswBiM1Wi+IVXtYBpM8oTB O8AxFL5iB+2gXIyGXqEYpittsUaexAM+g2RCF8WyLcQVfqSzx08LTlEfkoUdjXl7fb7g y9pw0fpxv7cexJs6MTEuxmJxXmWwHA/4gJb+ewq6yID76IRwJfxfAE0TOwiAeYD1/gG6 YQkbNXYFxErFNj4gqu/AA6u9CoaBkeyMKa9ur9OzorAs36NTSaNnYke1GgYcjr1upVwS +ZnA== X-Gm-Message-State: AOJu0YwwWUlDYYRqByNix0jZ+XG8AyXgRW+Ys9GSa3t0vmFcHmJo/Usk oa2SPIVt3W9Y80N85Df/OTRwPWLvwHDtOzWIgN+jfpJv46pPe8gxv2dGRKd43gBlQI0dUlP98dc 1os1pcbgH0YMfCha/le3mUHbWY0uFCuMl X-Google-Smtp-Source: AGHT+IHZ2fwxgT8peOjF2uXV1pn0eqHXPf14lHR3Ce8a6WRLrmwEexAlo5VnSIdQiioykLTXW7uGyR1Zr78A6r7bGj4= X-Received: by 2002:a05:6870:d60d:b0:254:994b:5e6b with SMTP id 586e51a60fabf-25842ba52d8mr13331571fac.44.1718699732348; Tue, 18 Jun 2024 01:35:32 -0700 (PDT) MIME-Version: 1.0 From: Dominique Devienne Date: Tue, 18 Jun 2024 10:35:21 +0200 Message-ID: Subject: set search_path "$owner". And name versus literal for schemas. To: pgsql-general@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi. Two things related to the search_path. First, [the doc][1] mentions one can use a variable like "$user" for the search_path. But setting the search_path is also for FUNCTIONs and PROCEDUREs, and there what I really REALLY would like, is the ability to use "$owner", to limit the search_path to the OWNER schema of that func/proc, instead of having to explicitly spell it out. When I want to *clone* a schema, having to "patch" the search_path of all those funcs/procs (to replace the old schema with the new one), is a real PITA. Has this ever been considered? And if so, why was it refused? It would simplify my life so much, I wonder why this doesn't already exist. Second, and related to the first point, when I introspect a schema, the search_path of functions/procedures seems to be rewritten with literals, instead of names. Even the doc uses names, so why is it rewritten as literals? Or accepts both in fact. To actually simplify schema cloning, the introspected proc/func search_path should remain "$owner" (or '$owner' I guess...) and not be expanded. Otherwise we'd back to "manual" patching of the search_path, which again is a PITA. I'm curious to hear/read what PostgreSQL experts have to say on this subject. Thanks, --DD [1]: https://www.postgresql.org/docs/current/ddl-schemas.html#DDL-SCHEMAS-PATH