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

Ask A Question

Stats

  • Questions 177k
  • Answers 177k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Since you're talking about internal usage, I assume you have… May 12, 2026 at 3:24 pm
  • Editorial Team
    Editorial Team added an answer It has to do with text file line endings and… May 12, 2026 at 3:24 pm
  • Editorial Team
    Editorial Team added an answer photos.style.backgroundPosition="0"+num; You need a unit for CSS lengths. photos.style.backgroundPosition= num+'px… May 12, 2026 at 3:24 pm

Related Questions

What is the pattern and/or how would you change the following code so that
Ok, I think whatever I'm doing wrong, it's probably blindingly obvious, but I can't
i have the following string: http://pastebin.com/d29ae565b i need to separate each value and put
I'm keen to drink some modern dynamic language koolaid, so I've believed all the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.