pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: negora <public@negora.com>
To: David Gauthier <dfgpostgres@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: How to reference a DB with a period in its name ?
Date: Fri, 29 Mar 2024 22:50:52 +0100
Message-ID: <36cef37d-32cf-45f4-a4ce-01dc29cad5e1@negora.com> (raw)
In-Reply-To: <CAEs=6DniFeqNT6RHCcPiiFFWzTGzQKMKboNch72Ftadr_W-Cdw@mail.gmail.com>
References: <CAEs=6DniFeqNT6RHCcPiiFFWzTGzQKMKboNch72Ftadr_W-Cdw@mail.gmail.com>

Hi:

I think your problem is in the Perl side more than in PostgreSQL's. When 
you said you tried escaping with \, Did you mean *exactly* this?

    "delete from \"thedb.v1\".theschem.thetab where col1 = 1"

I think this should work.

Or you can use single quotes to enclose the query, so that you don't 
need to escape the double quotes:

    'delete from "thedb.v1".theschem.thetab where col1 = 1'

Best regards.


On 29/03/2024 22:16, David Gauthier wrote:
> Hi:
>
> I have a DB named "thedb", which has a schema called "theschem" which 
> has a table called "thetab".  In a perl/DBI script, I am able to work 
> with the table by referencing it as... "thedb.theschem.thetab" as 
> in... "delete from thedb.theschem.thetab where col1=1"
>
> No problem (so far...)
>
> New DB now has a name "thedb.v1" (notice the "."), the schem and table 
> are the same as above.  But now I'm getting a syntax error presumably 
> because of that "." introduced in the DB name.
>
> I tried encapsulating the DB name in double quotes (no good), single 
> quotes (still no good) escaping with '\' (no good), escaping with ".." 
> (no good).
>
> Is there a way I can reference the DB which has the "." in it's name ?
>
> v11.5 on linux (I know, way past time to upgrade)
>
> Thanks in Advance !

view thread (8+ messages)  latest in thread

Message-ID: <36cef37d-32cf-45f4-a4ce-01dc29cad5e1@negora.com>
Permalink:  ../36cef37d-32cf-45f4-a4ce-01dc29cad5e1@negora.com/
Also on:    postgresql.org/message-id/36cef37d-32cf-45f4-a4ce-01dc29cad5e1@negora.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-general@postgresql.org
  Cc: public@negora.com, dfgpostgres@gmail.com, pgsql-general@lists.postgresql.org
  Subject: Re: How to reference a DB with a period in its name ?
  In-Reply-To: <36cef37d-32cf-45f4-a4ce-01dc29cad5e1@negora.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox