Tom,

You ain't arf clever.

Running Gen_fmgrtab.sh with a "set -x" shows:-

const FmgrBuiltin fmgr_builtins[] = {
+ awk { printf ("  { %d, \"%s\", %d, %s, %s, %s },\n"), \
        $1, $(NF-1), $9, \
        ($8 == "t") ? "true" : "false", \
        ($4 == "11") ? "true" : "false", \
        $(NF-1) } fmgr.raw 
awk: syntax error near line 3
awk: illegal statement near line 3
+ cat 
  /* dummy entry is easier than getting rid of comma after last real one */
  { 0, NULL, 0, false, false, (PGFunction) NULL }
};

/* Note fmgr_nbuiltins excludes the dummy entry */
const int fmgr_nbuiltins = (sizeof(fmgr_builtins) / sizeof(FmgrBuiltin)) - 1;

Looks like the problem is that, Solaris's awk is "old" awk.

If I change the awk to nawk I get valid output.

I'm just about to start the clean build process with this change.

Once it's started I'm off to bed. Will check in the morning.

Thanks for your trouble, we just need a "portable" fix now.

Thanks,
Keith. 

Tom Lane <tgl@sss.pgh.pa.us>
> 
> Keith Parks <emkxp01@mtcc.demon.co.uk> writes:
> > I've managed to get a backtrace, attached, thanks to Ross J. Reedstrom's
> > excellent example from the archives, also attached.
> 
> > I'm not sure whether the stack frame shown is corrupt, it seems to just
> > loop over and over again. (I got fed up after 400+ frames)
> 
> What we've got here is the syscache trying to set up for a search of
> cache 18, which I believe is the pg_proc-indexed-on-OID cache.
> For that it needs the OID comparison function, "oideq" (OID 184).
> It's asking the funcmgr for oideq ... and funcmgr is turning around
> and asking the syscache for the pg_proc entry with OID 184.  Ooops.
> 
<snip>
> My bet is that there is something snafu'd in your generation of
> fmgrtab.c from pg_proc.h via Gen_fmgrtab.sh, such that your table of
> builtin functions is either empty or corrupt.
> 
<snip>
> 
> If you still see the problem with a virgin build, take a look at
> src/backend/utils/Gen_fmgrtab.sh and its output
> src/backend/utils/fmgrtab.c to see if you can figure out what's
> wrong.  Could be that I introduced some kind of portability problem
> into Gen_fmgrtab.sh ...
> 
> 			regards, tom lane


Fri, 2 Jun 2000 00:44:04 +0100 (BST)
Keith Parks <emkxp01@mtcc.demon.co.uk>
Re: Problems with recent CVS versions and Solaris. 
Keith Parks <emkxp01@mtcc.demon.co.uk> writes:
> Running Gen_fmgrtab.sh with a "set -x" shows:-

> const FmgrBuiltin fmgr_builtins[] = {
> + awk { printf ("  { %d, \"%s\", %d, %s, %s, %s },\n"), \
>         $1, $(NF-1), $9, \
>         ($8 == "t") ? "true" : "false", \
>         ($4 == "11") ? "true" : "false", \
>         $(NF-1) } fmgr.raw 
> awk: syntax error near line 3
> awk: illegal statement near line 3

Ugh.  I think that the former version of the script didn't use
conditional expressions (a ? b : c).  Perhaps old versions of
awk don't have those?  If so we can probably work around it...

			regards, tom lane

Thu, 01 Jun 2000 19:53:09 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Problems with recent CVS versions and Solaris. 
> Ugh.  I think that the former version of the script didn't use
> conditional expressions (a ? b : c).  Perhaps old versions of
> awk don't have those?

Indeed, the GNU awk manual says so very clearly :-(

Keith, I've committed a new version of Gen_fmgrtab.sh.in;
would you check that it works on your copy of awk?

			regards, tom lane

Thu, 01 Jun 2000 22:01:56 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Problems with recent CVS versions and Solaris. 
Tom Lane writes:

> Ugh.  I think that the former version of the script didn't use
> conditional expressions (a ? b : c).  Perhaps old versions of
> awk don't have those?  If so we can probably work around it...

While you're at it, you should use AC_PROG_AWK to potentially find the
most modern and fastest awk on the system. Also, it seems that script has
really little to no checking of exit statuses. A segfault during initdb is
a really obscure place to find out about awk syntax errors.

-- 
Peter Eisentraut                  Sernanders vï¿½g 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden


Sat, 3 Jun 2000 01:47:12 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: Problems with recent CVS versions and Solaris. 
Peter Eisentraut <peter_e@gmx.net> writes:
> While you're at it, you should use AC_PROG_AWK to potentially find the
> most modern and fastest awk on the system. Also, it seems that script has
> really little to no checking of exit statuses.

True.  Wanna fix it?  I'm not planning to touch it again soon...

			regards, tom lane

Fri, 02 Jun 2000 22:50:35 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Problems with recent CVS versions and Solaris. 