createdb argument question
For some odd reason, Rails decided to call createdb as:
createdb foo_database -E utf8
On my Mac systems, this work. On my AIX system it does not. I get:
createdb dog -E utf8
createdb: too many command-line arguments (first is "utf8")
Try "createdb --help" for more information.
Has anyone else bumped in to this? Is putting the arguments after
the database name known to work? Looking at the code, it seems
rather magical that it works but I just looked at the main routine in
createdb.c and not the routines it calls.
Thank you for your help,
Perry
On Oct 27, 2007, at 12:56 , Perry Smith wrote:
On my Mac systems, this work. On my AIX system it does not. I get:
Versions?
Michael Glaesemann
grzm seespotcode net
On Oct 27, 2007, at 1:41 PM, Michael Glaesemann wrote:
On Oct 27, 2007, at 12:56 , Perry Smith wrote:
On my Mac systems, this work. On my AIX system it does not. I get:
Versions?
My AIX is 5.3 close to the latest. Postgres is 8.2.4 I built all of
the open source stuff myself using gcc 4.0.2. (but, as I recall,
Postgres just builds without any real coaxing or libs, etc from me).
My working Mac is 10.4. Postgres I have 8.2.4 on one system and
8.1.3 on another (both work with the -E after the database argument).
Thanks
Perry
Michael Glaesemann <grzm@seespotcode.net> writes:
On Oct 27, 2007, at 12:56 , Perry Smith wrote:
On my Mac systems, this work. On my AIX system it does not. I get:
Versions?
I think the old shell-script version of createdb, in 7.3 and before,
might have taken that ordering of arguments ...
regards, tom lane
On Sat, Oct 27, 2007 at 12:56:37PM -0500, Perry Smith wrote:
On my Mac systems, this work. On my AIX system it does not. I get:
createdb dog -E utf8
createdb: too many command-line arguments (first is "utf8")
Try "createdb --help" for more information.Has anyone else bumped in to this? Is putting the arguments after
the database name known to work? Looking at the code, it seems
rather magical that it works but I just looked at the main routine in
createdb.c and not the routines it calls.
It's been a while since I've dealt with AIX, but try putting your
options before the option-less arguments. How it works is not magical,
it's just using getopt_long, and some getopts stop checking for options
after the first non-option argument it receives.
--
Seneca
tentra@gmail.com
On Oct 27, 2007, at 3:02 PM, Seneca Cunningham wrote:
On Sat, Oct 27, 2007 at 12:56:37PM -0500, Perry Smith wrote:
On my Mac systems, this work. On my AIX system it does not. I get:
createdb dog -E utf8
createdb: too many command-line arguments (first is "utf8")
Try "createdb --help" for more information.Has anyone else bumped in to this? Is putting the arguments after
the database name known to work? Looking at the code, it seems
rather magical that it works but I just looked at the main routine in
createdb.c and not the routines it calls.It's been a while since I've dealt with AIX, but try putting your
options before the option-less arguments. How it works is not
magical,
it's just using getopt_long, and some getopts stop checking for
options
after the first non-option argument it receives.
Well, it turns out that if getopt_long is not in the system's libc,
then postgres uses the getopt_long that is packaged with it. This
version works like I think it should -- it expects the non-option
argument at the end.
The getopt_long on Mac and I guess also Linux have been made non-
Posix compliant. They accept options after the non-option argument.
What is really disturbing is they alter argv. I find that somewhat a
bad idea but, I guess no one really cares about consistency or
traditions.
Anyhow... that is the reason AIX does it the way I expect it but the
others do not.
Thank you for your help,
Perry Smith ( pedz@easesoftware.com )
Ease Software, Inc. ( http://www.easesoftware.com )
Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems
"Perry Smith" <pedz@easesoftware.com> writes:
The getopt_long on Mac and I guess also Linux have been made non-
Posix compliant. They accept options after the non-option argument. What is
really disturbing is they alter argv. I find that somewhat a bad idea but, I
guess no one really cares about consistency or traditions.
You can get the traditional behaviour out of glibc if you set POSIXLY_CORRECT.
One thing to beware of is that patch behaves very strangely with
POSIXLY_CORRECT set though.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com