Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 312085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:59:02+00:00 2026-05-12T07:59:02+00:00

How do you read the following line of code? The code is from SO

  • 0

How do you read the following line of code?
The code is from SO by John Saunders. (Please add a link to it if you find it)

SET search_path TO so,"$user", public;

Context

START TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ WRITE;   
CREATE SCHEMA SO 
SET search_path TO so,"$user", public;        /// here
...

I read the line as “set your chosen PATH to your schema for a given user publicly“.
Public seems to mean that the PATH or user is public.
I am not sure why we need to quota the variable user, since everything is lowercase.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T07:59:02+00:00Added an answer on May 12, 2026 at 7:59 am

    Setting the search_path is extremely common when you have a database with enough tables that they’ve been split up into multiple schemas. The path to understand what it does and is used for is to start with the schema documentation, which covers the role of the public schema in things too.

    The way $user is substituted when it appears in that path is described in the docs for search_path:

    “If one of the list items is the
    special value $user, then the schema
    having the name returned by
    SESSION_USER is substituted, if there
    is such a schema”.

    Obviously your next question is then what’s SESSION_USER? That starts as the username you connect to the database as, but can change via commands like SET SESSION AUTHORIZATION. The idea is that it can help you setup a schema for each user, which can be a useful way to lock down security for each user. I’ve only ever heard of that being used in a simple database hosting type of environment where each user gets their own role and schema but not their own database. You can probably leave the “$user” part out of there and not impact anything, it just shows up by default and most don’t know you can remove it if you’re not relying on it.

    $user is in quotes because that is a reserved word in the SQL standard. You can name things using reserved words if you must in PostgreSQL, even though it’s a bad idea, but you have to put them in quotes all the time so that the SQL parser doesn’t misinterpret them. This can bite you with odd errors if you try and use a reserved word as the name of a column or table. Some you might accidentally try to use as column names in addition to “user” because they map to common real-world things include case, default, end, full, left, new, offset, order, and references.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following piece of code should read each line of the file and operate
What I want to do is the following: read in multiple line input from
I have the following basic code to read a text file from a StreamReader:
I use the following code (from Bluetooth Chat sample app) to read the incoming
I'm writing the following code to read in a file from the filepath given
How do I convert the following line of code from VB.NET to C#. Dim
The following line in my C program should provided All/Group/Owner read and write permissions
I read a guide . It says that run the following line and forget
I have read the following properties from AD, TerminalServicesProfilePath TerminalServicesHomeDirectory TerminalServicesHomeDrive I've tried DirectoryEntry
I tried to run the following code from http://docs.python.org/library/mmap.html import mmap # write a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.