Re: [HACKERS] Database names with spaces

Lists: pgsql-hackers
From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Database names with spaces
Date: 1999-10-05 22:42:31
Message-ID: 12508.939163351@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> writes:
> Looks like a bug. Added to TODO list.

>> I see a todo item
>> * Views with spaces in view name fail when referenced
>>
>> I have another one for you:
>> * Databases with spaces in name fail to be created and destroyed despite
>> responses to the contrary.

IIRC, createdb and destroydb use "cp -r" and "rm -r" respectively.
Lack of careful quoting in the system calls is probably what's
causing the problem here.

However, I wonder if it wouldn't be a better idea to forbid funny
characters in things that will become Unix filenames. In particular,
something like CREATE DATABASE "../../../something" could have real
bad consequences...

regards, tom lane


From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Database names with spaces
Date: 1999-10-06 03:08:47
Message-ID: 199910060308.XAA05984@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Looks like a bug. Added to TODO list.
>
> >> I see a todo item
> >> * Views with spaces in view name fail when referenced
> >>
> >> I have another one for you:
> >> * Databases with spaces in name fail to be created and destroyed despite
> >> responses to the contrary.
>
> IIRC, createdb and destroydb use "cp -r" and "rm -r" respectively.
> Lack of careful quoting in the system calls is probably what's
> causing the problem here.
>
> However, I wonder if it wouldn't be a better idea to forbid funny
> characters in things that will become Unix filenames. In particular,
> something like CREATE DATABASE "../../../something" could have real
> bad consequences...

I just tried it:

test=> create database "../../pg_hba.conf"
test-> \g
ERROR: Unable to locate path '../../pg_hba.conf'
This may be due to a missing environment variable in the server

Seems we are safe.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026