On Thu, Oct 30, 2014 at 12:21 AM, Tomas Vondra <tv@fuzzy.cz> wrote:
Dne 29 Říjen 2014, 10:41, David Rowley napsal(a):
> I'm quite interested in reviewing your work on this, but it appears that > some of your changes are not C89: > > src\backend\commands\analyze.c(3774): error C2057: expected constant > expression [D:\Postgres\a\postgres.vcxproj] > src\backend\commands\analyze.c(3774): error C2466: cannot allocate an > array of constant size 0 [D:\Postgres\a\postgres.vcxproj] > src\backend\commands\analyze.c(3774): error C2133: 'indexes' : unknown > size [D:\Postgres\a\postgres.vcxproj] > src\backend\commands\analyze.c(4302): error C2057: expected constant > expression [D:\Postgres\a\postgres.vcxproj] > src\backend\commands\analyze.c(4302): error C2466: cannot allocate an > array of constant size 0 [D:\Postgres\a\postgres.vcxproj] > src\backend\commands\analyze.c(4302): error C2133: 'ndistincts' : unknown > size [D:\Postgres\a\postgres.vcxproj] > src\backend\commands\analyze.c(4775): error C2057: expected constant > expression [D:\Postgres\a\postgres.vcxproj] > src\backend\commands\analyze.c(4775): error C2466: cannot allocate an > array of constant size 0 [D:\Postgres\a\postgres.vcxproj] > src\backend\commands\analyze.c(4775): error C2133: 'keys' : unknown size > [D:\Postgres\a\postgres.vcxproj] >
I'll look into that. The thing is I don't have access to MSVC, so it's a bit difficult to spot / fix those issues :-(
It should be a pretty simple fix, just use the files and line numbers from the above. It's just a problem that in those 3 places you're declaring an array of a variable size, which is not allowed in C89. The thing to do instead would just be to palloc() the size you need and the pfree() it when you're done.