[GENERAL] PowerDesigner 15

2010-12-28 Thread el dorado

Hello!

I would like to get more flexible tool for database management that EMS of 
pgadmin. So now I'm trying to use PD 15 with Postgres 8.4.1. It's very exciting 
:)
So what can I say?
It seems to be there are no problems with tables, sequences, FK... But there 
are some difficulties with:
1. Stored porcedures
At this branch of DBMS definition file  - PostgreSQL 
8::Script\Objects\Procedure\Create - I write the following:

CREATE FUNCTION %PROC%(%PROCPRMS%)
as $body$
%TRGDEFN%
$body$
LANGUAGE  '%ProcLanguage%'  VOLATILE CALLED ON NULL INPUT SECURITY DEFINER;

When I do reverse engineering I get the script of procedure, f.e.:
CREATE FUNCTION %PROC%()
as $body$
BEGIN   
RETURN i+1; 
END
$body$
LANGUAGE  '%ProcLanguage%'  VOLATILE CALLED ON NULL INPUT SECURITY DEFINER;

The problem is that there is that there should be some params - but here the 
list of params is empty. 

2. Schemas
PD interprets schemas as users - for some reason. I have no definite idea - is 
there any opportunity to teach PD to work with schemas correctly? Maybe it's 
necessary to add some structure to 'Object' section or 'Profile' section of 
DBMS definition file ?

It's interesting at all - does anybody successfully use PD with Postgres? I'll 
appreciate any notices. There is no much information about it.

Regards, Marina.


Re[2]: [GENERAL] Problems with Vista and Windows 7

2010-07-08 Thread el dorado
Thank you, Andrew, it's very interesting and cognitive article. 
Though it couldn't resolve my problem now. It looks like recommendations - 
where to put your application data. But I put my data in some definite location 
and postgres looks for it in another one - that's the strangeness of situation 
for me.

Regards, Marina.

> It is a vexed issue with Vista/Windows 7. 
> I found this somewhere on a blog on the web (it may help):
> 
> Regards
>Andrew


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re[2]: [GENERAL] Problems with Vista and Windows 7

2010-07-08 Thread el dorado
> > I've notice that in some special cases PG uses folder 
> > %APPDATA% for Windows user 'postgres', instead of the 
> > PostgreSQL-specific application data folder (f.e., 
> > C:\PostgreSQL\8.4\data). It results in some unexpected bugs. 

> 
> Could you please be more specific in describing what problems are you
> seeing on Win7?
> Regards, Igor Neyman 
> 
> What files are being created in %APPDATA% for the postgres user? Or
> what's it looking for there that's causing issues?
> Craig Ringer

Thank you for your answers.
Well, the beginning of the story in details is here 
(http://archives.postgresql.org/pgsql-general/2010-06/msg01135.php). Shortly, I 
tried to use functions from my own dll, but got an error "Could not open 
relation base\16123\16222: No such file or directory". Later I found out, using 
'Process Monitor', that for some reason process 'postgres.exe' looked for this 
relation not in 'C:\PostgreSQL\8.4\data\base\16123\16222' but in 
'C:\Users\postgres\AppData\Roaming\MyApplicationName\base\16123\16222' - 
certainly, there is no such file.


> Did you check, that registry key "Data Directory" is set properly in
> "HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-8.4"
> folder?
Usually I don't use standard Windows Installer but take binaries. So there is 
no such branch in registry. When I tried to make test and install it from 
Installer I got the same result. :( "Data Directory" was set to PG-specific 
application dir.

Regards, Marina.



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Problems with Vista and Windows 7

2010-07-07 Thread el dorado
Hello!
I use Postgres 8.4.1 as service, with Windows 7. It seems to me the same 
situation will take place with Vista.

I've notice that in some special cases PG uses folder %APPDATA% for Windows 
user 'postgres', instead of the PostgreSQL-specific application data folder 
(f.e., C:\PostgreSQL\8.4\data). It results in some unexpected bugs. There were 
no such effects in Win XP and 2000.

Has anyone fixed something similar to the described situation? Is it possible 
to improve it?

Regards, Marina.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Windows7 and user-defined procedure

2010-06-25 Thread el dorado
Hello!
I have user-defined procedure (C procedure) realised in dll 
('c_some_text_dll'). It is called in the following way:

1. CREATE OR REPLACE FUNCTION "app_text" () RETURNS text AS
'$libdir/c_some_text_dll', 'getTextValueFromApplication'
LANGUAGE 'c' VOLATILE RETURNS NULL ON NULL INPUT SECURITY INVOKER;


2. CREATE TABLE "log" (
  "id" SERIAL, 
  "value" TEXT DEFAULT app_text() NOT NULL 
 ) 

So when called from my application some stored procedure containing 'INSERT 
INTO log...' there was the result of 'app_text()' in the field 'value'.

It works in XP and Win2000. I'm trying to test in Windows 7 now and get an 
error when inserting data in table 'log': "Could not open relation 
base\16123\16222: No such file or directory".
The file '16222' exists and represents the table 'log' itself. All the 
imaginable rights for files and directories are set - as it seems to me.
One more detail - if I call this procedure from some other client application, 
f.e., psql (SELECT * FROM app_text()), before this INSERT - it begins to work 
in my application too. 

Are there any ideas? I'll appreciate any help.

Thanks, Marina.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] could not open process token: error code 5

2009-10-14 Thread el dorado

Hello.
I had such an error but rather long ago. Unfortunately I don't remember all the 
details but you could try to do the followig:
- check if the directory 'data' has read/write rights for your OS account 
(account under which you try to start postgres).
- check if your OS account has the right to log on as service (Administrative 
Tools/Local Security Settings/User Rights Assignment)
- check in Computer Management/Local Users and Groups/Users if your OS account 
is NOT the member of any group of users.

Regards, Marina.

> 
> Hi
> 
> We have an Postgresql 8.2.5 installation on a Windows server 2003 that have
> worked perfectly for our Mediawiki until we tried to update to 8.4. Before
> the update we took a backup, stopped the service and took a copy of the
> entire database catalog. We could not make the 8.4 (installed in a different
> directory) work so we decided to go back to the initial installation which
> remained intact. 
> 
> Then when we try to start the service it fails and we get the message "could
> not open process token: error code 5" in the event viewer, nothing else. Now
> after googling for some hours and days I am stuck. the Postgres user are to
> start the service and so nothing is changed there either. Even though the
> database files were not changed, we have also copied the entire original
> database back. The installation has been done with the
> "postgresql-8.2-int.msi" package and it has been reapplied with the
> following command, "msiexec /i postgresql-8.2-int.msi REINSTALLMODE=vamus
> REINSTALL=ALL /"
> 
> Still no progress.
> 
> What to do?
> 
> /Anders
>

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re[3]: [GENERAL] Build PG 8.4 (MinGW vs. MSVC)

2009-09-29 Thread el dorado

> > > What is recommended now for building PG 8.4 for WinXP? Is it better to 
> > > use MSVC compiler?>
> Regards, Marina.
>  
> > MingW is perfectly supported, and we know people use it.
> > MSVC is the recommended one I'd say, mainly because that's how the
> > official binaries are built, so the results are much more well-tested.
> >  Magnus Hagander
> 
> Thank you very much for your answer.
> According to your recommendation I try to use MSVC as described here 
> http://www.postgresql.org/docs/8.4/interactive/install-win32-full.html. 
> I configure options in config.pl and run build. I don't build from CVS and I 
> know from documentation that "Bison and Flex are required to build from CVS, 
> but not required when building from a release file". But I get the error:
> 
> Done building project "pgsql.sln" -- FAILED
> Build FAILED.
> Project : error PRJ0019: A tool returned an error from "Running bison on 
> src\interfaces\ecpg\preproc\preproc.y"
> 0 Warning(s)
> 1 Error(s)
> Maybe I should set some other options in configuration files? I didn't find 
> any information about it in documentation... :(
> Regards, Marina.
> 

Hello!
Maybe this information will be useful for someone.
I built PG 8.4.1 by MSVC as discribed in documentation 
(http://www.postgresql.org/docs/8.4/interactive/install-win32-full.html) 
without bison and flex. But it was a little bit tricky. I simply cleared the 
file pgbison.bat. It was empty and there was no attempts to call bison. So I 
escaped the error mentioned some lines upper.
However it seems to me some regular way to do it should exist. But I don't see 
the way. I wonder if I really missed some important parameter in configuration? 
Or my method is correct? :)
Thanks in advance, Marina.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re[2]: [GENERAL] Build PG 8.4 (MinGW vs. MSVC)

2009-09-21 Thread el dorado
> > What is recommended now for building PG 8.4 for WinXP? Is it better to use 
> > MSVC compiler?>
 
> MingW is perfectly supported, and we know people use it.
> MSVC is the recommended one I'd say, mainly because that's how the
> official binaries are built, so the results are much more well-tested.
> It also produces builds that are compatible with standard platform
> debugger and profiling tools.
>  Magnus Hagander

Thank you very much for your answer.
According to your recommendation I try to use MSVC as described here 
http://www.postgresql.org/docs/8.4/interactive/install-win32-full.html. 
I configure options in config.pl and run build. I don't build from CVS and I 
know from documentation that "Bison and Flex are required to build from CVS, 
but not required when building from a release file". But I get the error:

Done building project "pgsql.sln" -- FAILED
Build FAILED.
Project : error PRJ0019: A tool returned an error from "Running bison on 
src\interfaces\ecpg\preproc\preproc.y"
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:56:12

Maybe I should set some other options in configuration files? I didn't find any 
information about it in documentation... :(

Regards, Marina.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Build PG 8.4 (MinGW vs. MSVC)

2009-09-18 Thread el dorado
Hello!
I need to build PG 8.4 from sources for WinXP. There are two ways to do it: by 
means of MinGW of by means of MSVC. Firstly I used MinGW (gcc), but 
unfortunately I noticed some problems with result biniries (f.e. 
http://archives.postgresql.org/pgsql-general/2009-09/msg00526.php).
What is recommended now for building PG 8.4 for WinXP? Is it better to use MSVC 
compiler?
Thank in advance.

Regards, Marina.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Build PG 8

2009-09-18 Thread el dorado

-Original Message-
From: el dorado 
To: pgsql-general@postgresql.org
Date: Fri, 18 Sep 2009 15:24:24 +0400
Subject: [GENERAL] Build PG 8

Sorry, the previous letter was sent by mistake. 



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Build PG 8

2009-09-18 Thread el dorado


Лучшие предложения интернет-магазинов на Това�...@mail.ru 
http://r.mail.ru/cln4267/torg.mail.ru/

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re[3]: [GENERAL] Problems with pg_dump for PG8.4 for WinXP (MinGW build)

2009-09-18 Thread el dorado
> Hello!
> Thank you very much for your answer. I try to use gdb now. But there is a 
> little difficulty. I'm not quite sure it is connected with postgres build. 
> Probably I do something wrong using gdb but maybe you could show me the 
> direction for resolving the problem?
> I built PostgreSQL 8.4 (WinXP, MinGW) with following configuration options:
> configure --without-zlib --enable-debug --enable-cassert --enable-depend
> So I supposed the result should include debugging symbols.
> But I don't see the function names in the backtrace. It looks like:
> (gdb) bt
> #0 0x7c8106e9 in ?? ()
> #1 0x in ?? ()
> (gdb)
> Maybe you could advise me how to get more detailed information?
> I'll appreciate any help.

Hello!
Sorry for disturbing. I've found out what was the problem. 
I should set CFLAGS in configuration options. Now there is the following:
configure --without-zlib --enable-debug --enable-cassert --enable-depend 
CFLAGS='-Zi -g'

Regards, Marina.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re[2]: [GENERAL] Problems with pg_dump for PG8.4 for WinXP (MinGW build)

2009-09-17 Thread el dorado

> 2009/9/15 el dorado :
> > Hello!
> > I need PG 8.4 built from source code for WinXP. So I got archive 
> > postgresql-8.4.1.tar.gz, unpacked it and built postgres by MinGW.
> > Everything seeds to be fine until we tried to test pg_dump. It failed (not 
> > always but often).
> > Command:
> > pg_dump -U postgres -v -f mydump.sql TEST_DB
> > And here we get a message 'an unhandled win32 exception occured in 
> > pg_dump.exe'
 
> Given that, it seems to be something with your mingw setup causing it.
> I think you'll have to get yourself a backtrace using gdb (the native
> debugger tools can usually not get usable backtraces from a a mingw
> build).
>  Magnus Hagander

Hello!
Thank you very much for your answer. I try to use gdb now. But there is a 
little difficulty. I'm not quite sure it is connected with postgres build. 
Probably I do something wrong using gdb but maybe you could show me the 
direction for resolving the problem?
I built PostgreSQL 8.4 (WinXP, MinGW) with following configuration options:
configure --without-zlib --enable-debug --enable-cassert --enable-depend
So I supposed the result should include debugging symbols.
But I don't see the function names in the backtrace. It looks like:
(gdb) bt
#0 0x7c8106e9 in ?? ()
#1 0x in ?? ()
(gdb)
Maybe you could advise me how to get more detailed information?
I'll appreciate any help.

Regard, Marina.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Problems with pg_dump for PG8.4 for WinXP (MinGW build)

2009-09-15 Thread el dorado
Hello!
I need PG 8.4 built from source code for WinXP. So I got archive 
postgresql-8.4.1.tar.gz, unpacked it and built postgres by MinGW, as usual:
configure --witout-zlib
make
make install

Everything seeds to be fine until we tried to test pg_dump. It failed (not 
always but often). 
Command: 
pg_dump -U postgres -v -f mydump.sql TEST_DB

The end of output:
pg_dump: reading triggers for table "test_table"
pg_dump: reading dependency data
pg_dump: saving encoding = UTF8
pg_dump: saving standard_conforming_string = off
pg_dump: saving database definition

And here we get a message 'an unhandled win32 exception occured in 
pg_dump.exe(1788)' 
(digits in brackets varies for different runs of pg_dump)

There are no such problems for ready biniries.

Regards, Marina.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Postgres 8.3.3 & MSVC2005 (full edition)

2008-07-22 Thread el dorado
Hello.
Have I an opportunity to get working dll using MSVC2005 (full edition) for 
compilation at all?
I just tried to compile the following code. This is full text. Project options 
are below in the letter.
-
#include "postgres.h"
#include "fmgr.h"
#include "executor/executor.h" 
#include "utils/timestamp.h"
#include "utils/builtins.h"
#include "utils/formatting.h"

#define BUILDING_DLL 1

#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif

PG_FUNCTION_INFO_V1(add_one);
 
Datum
add_one(PG_FUNCTION_ARGS)
{
int32   arg = PG_GETARG_INT32(0);
PG_RETURN_INT32(arg + 1);
}
---
CREATE FUNCTION "service"."add_one"() RETURNS integer
 AS '$libdir/my_dll', 'pg_finfo_add_one'
 LANGUAGE C STRICT;

Result:
Query OK (0,11 sec)
Return Value: 32593236

Even if I do the following:
PG_FUNCTION_INFO_V1(add_one);
 
Datum
add_one(PG_FUNCTION_ARGS)
{
PG_RETURN_INT32(10);
}

I get the same result - Return Value: 32593236

Have I forget some important option? Or I can't use the FULL version for 
compilation at all - only express edition?

By the way - there is a directory 'D:\pgsql83\include\server\port\win32_msvc'. 
But I can't use it instead of 'D:\pgsql83\include\server\port\win32' (should I 
?) - there is an error due to lack of file 'netdb.h' and some others in this 
directory.


Thanks in advance, Marina.


-Original Message-
From: el dorado <[EMAIL PROTECTED]>
To: pgsql-general@postgresql.org
Date: Fri, 18 Jul 2008 11:17:51 +0400
Subject: [GENERAL] C-procedure crashed in Postgres 8.3.3 when using 'text' 
variable (WinXP) - additional

> 
> Hello.
> I'm trying to create a C-procedure returning text variable - again :).
> Postgres 8.3.3 (standard binaries - so built by means of MSVC), WinXP SP2.
> I also use MSVC 2005 for compilation my library.
> Configuration type - Dynamic Library (.dll)
> Additional include directories - 
> D:\pgsql83\include;D:\pgsql83\include\server;D:\pgsql83\include\server\port\win32
> Additional library directories - D:\pgsql83\lib
> Additional dependencies - postgres.lib
> Compile as C Code (/TC)
> Detect 64-bit portability issues - No
>  
> So, here is the code:
> --
> include "postgres.h"
> #include "fmgr.h"
> #include "executor/executor.h" 
> #include "utils/timestamp.h"
> #include "utils/builtins.h"
> #include "utils/formatting.h"
> 
> #ifdef PG_MODULE_MAGIC
> PG_MODULE_MAGIC;
> #endif
> 
> #define GET_TEXT(cstrp) DatumGetTextP(DirectFunctionCall1(textin, 
> CStringGetDatum(cstrp)))
> 
> PG_FUNCTION_INFO_V1(getTimeFromApplication);
> Datum
> getTimeFromApplication(PG_FUNCTION_ARGS)
> {
> PG_RETURN_TEXT_P(GET_TEXT("success"));
> }
> 
> I can compile it and get the library, but there are some warnings:
> 1>d:\pgsql83\getstring\c_getstring.c(10) : warning C4273: 'Pg_magic_func' : 
> inconsistent dll linkage
> 1>d:\pgsql83\getstring\c_getstring.c(10) : see previous definition of 
> 'Pg_magic_func'
> 1>d:\pgsql83\getstring\c_getstring.c(24) : warning C4273: 
> 'pg_finfo_getTimeFromApplication' : inconsistent dll linkage
> 1>d:\pgsql83\getstring\c_getstring.c(24) : see previous definition of 
> 'pg_finfo_getTimeFromApplication'
> ---
> Then I put the library into 'lib' directory and create the stored procedure:
> CREATE OR REPLACE FUNCTION "service"."get_app_time" () RETURNS text AS
>  '$libdir/getstring', 'pg_finfo_getTimeFromApplication'
>  LANGUAGE C STRICT; 
> 
> Then I try to run it:
> select * from "service"."get_app_time" ();
> 
> And get an error:
> ERROR:  invalid memory alloc request size 4294967293
> 
> What did I wrong?
> 
> Thanks in advance, Marina.
> 
> 
> -- 
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
> 

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Fw: Re: [GENERAL] C-procedure crashed in Postgres 8.3.3 when using 'text'variable (WinXP) - additional

2008-07-21 Thread el dorado
Yes, I use a Microsoft Visual Studio compiler, but the full version - not 
Express Edition. Just in case I quote the code again ( it's short):

--
include "postgres.h"
#include "fmgr.h"
#include "executor/executor.h" 
#include "utils/timestamp.h"
#include "utils/builtins.h"
#include "utils/formatting.h"

#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif

#define GET_TEXT(cstrp) DatumGetTextP(DirectFunctionCall1(textin, 
CStringGetDatum(cstrp)))

PG_FUNCTION_INFO_V1(getTimeFromApplication);
Datum
getTimeFromApplication(PG_FUNCTION_ARGS)
{
PG_RETURN_TEXT_P(GET_TEXT("success"));
}
--
Preprocessor definitions:WIN32;_DEBUG;_WINDOWS;_USRDLL;C_SYNCTIME_EXPORTS
Postgres 8.3.3 (standard binaries - so built by means of MSVC), WinXP SP2.
Error while using the function in PG - invalid memory alloc request size 
4294967293

It seems to me I must change some other options in Configuration Properties - 
but I can't guess what exactly...
Or maybe I should use Visual Studio 2005 Express Edition necessarily?

Redards, Marina.


> 
> el dorado wrote:
> >  
> >  Hello.
> >  Thank you very much for your answer.
> 
> >  1>d:\pgsql83\getstring\c_getstring.c(10) : warning C4273: 'Pg_magic_func' 
> > : inconsistent dll linkage
> >  1>d:\pgsql83\getstring\c_getstring.c(10) : see previous definition 
> > of 'Pg_magic_func'
> 
> This should be a big red flag to you. It suggests that you have issues 
> with __declspec(dllimport) and __declspec(dllexport) annotations.
> 
> It looks like you are using a Microsoft Visual Studio compiler. If you 
> are using Visual Studio 2005 Express Edition you must modify the 
> project's preprocessor definitions to set the WIN32 macro, as 2005 
> Express Edition does not do so by default. See earlier discussion in the 
> archives from a few months ago.
> 
> Alternately, modify the definition of the default win32 project to set 
> the right macros, then create a new project.
> 
> This issue does NOT affect the full version, only the Express edition. 
> It also does not affect 2008 Express Edition. I've just reproduced it on 
> a clean install of Windows and the Express Edition.
> 
> --
> Craig Ringer
> 

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] C-procedure crashed in Postgres 8.3.3 when using 'text' variable (WinXP) - additional

2008-07-21 Thread el dorado
 
 Hello.
 Thank you very much for your answer.
 I found an option "Configuration Properties\C/C++/General/Detect 64-bit 
Portability Issues". It was set to 'Yes'. I made it 'No'.
 Now I don't get these warnings about 'type cast'.
 The result:
 1>Compiling...
 1>getstring.c
 1>d:\pgsql83\getstring\c_getstring.c(10) : warning C4273: 'Pg_magic_func' : 
inconsistent dll linkage
 1>d:\pgsql83\getstring\c_getstring.c(10) : see previous definition of 
'Pg_magic_func'
 1>d:\pgsql83\getstring\c_getstring.c(24) : warning C4273: 
'pg_finfo_getTimeFromApplication' : inconsistent dll linkage
 1>d:\pgsql83\getstring\c_getstring.c(24) : see previous definition of 
'pg_finfo_getTimeFromApplication'
 1>Compiling manifest to resources...
 1>Linking...
 1>LINK : D:\pgsql83\c_getstring\Debug\getstring.dll not found or not built by 
the last incremental link; performing full link
 1>   Creating library D:\pgsql83\getstring\Debug\getstring.lib and object 
D:\pgsql83\getstring\Debug\getstring.exp
 1>Embedding manifest...
 1>Build log was saved at 
"file://d:\pgsql83\getstring\getstring\Debug\BuildLog.htm"
 1>c_synctime - 0 error(s), 2 warning(s)
 == Rebuild All: 1 succeeded, 0 failed, 0 skipped ==
 
 But the function doesn't work as well :(
ERROR:  invalid memory alloc request size 4294967293
 

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] C-procedure crashed in Postgres 8.3.3 when using 'text' variable (WinXP) - additional

2008-07-18 Thread el dorado
Hello.
I'm trying to create a C-procedure returning text variable - again :).
Postgres 8.3.3 (standard binaries - so built by means of MSVC), WinXP SP2.
I also use MSVC 2005 for compilation my library.
Configuration type - Dynamic Library (.dll)
Additional include directories - 
D:\pgsql83\include;D:\pgsql83\include\server;D:\pgsql83\include\server\port\win32
Additional library directories - D:\pgsql83\lib
Additional dependencies - postgres.lib
Compile as C Code (/TC)
(By the way, I can't compile it as C++ Code (/TP)
In this case I get a lot of errors. F.e.
>d:\pgsql83\include\server\nodes\primnodes.h(1078) : error C2238: unexpected 
>token(s) preceding ';'
1>d:\pgsql83\include\server\nodes\parsenodes.h(167) : error C2059: syntax error 
: 'typeid' )

So, here is the code:
--
include "postgres.h"
#include "fmgr.h"
#include "executor/executor.h" 
#include "utils/timestamp.h"
#include "utils/builtins.h"
#include "utils/formatting.h"

#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif

#define GET_TEXT(cstrp) DatumGetTextP(DirectFunctionCall1(textin, 
CStringGetDatum(cstrp)))

PG_FUNCTION_INFO_V1(getTimeFromApplication);
Datum
getTimeFromApplication(PG_FUNCTION_ARGS)
{
PG_RETURN_TEXT_P(GET_TEXT("success"));
}

I can compile it and get the library, but there are some warnings:
1>d:\pgsql83\getstring\c_getstring.c(10) : warning C4273: 'Pg_magic_func' : 
inconsistent dll linkage
1>d:\pgsql83\getstring\c_getstring.c(10) : see previous definition of 
'Pg_magic_func'
1>d:\pgsql83\getstring\c_getstring.c(24) : warning C4273: 
'pg_finfo_getTimeFromApplication' : inconsistent dll linkage
1>d:\pgsql83\getstring\c_getstring.c(24) : see previous definition of 
'pg_finfo_getTimeFromApplication'
1>d:\pgsql83\getstring\c_getstring.c(75) : warning C4311: 'type cast' : pointer 
truncation from 'char [8]' to 'Datum'
1>d:\pgsql83\getstring\c_getstring.c(75) : warning C4312: 'type cast' : 
conversion from 'Datum' to 'Pointer' of greater size
1>d:\pgsql83\getstring\c_getstring.c(75) : warning C4311: 'type cast' : pointer 
truncation from 'varlena *' to 'Datum'
---
Then I put the library into 'lib' directory and create the stored procedure:
CREATE OR REPLACE FUNCTION "service"."get_app_time" () RETURNS text AS
 '$libdir/getstring', 'pg_finfo_getTimeFromApplication'
 LANGUAGE C STRICT; 

Then I try to run it:
select * from "service"."get_app_time" ();

And get an error:
ERROR:  invalid memory alloc request size 4294967293

What did I wrong?

Thanks in advance, Marina.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Standard binaries compilier - how to know?

2008-07-17 Thread el dorado
Hello!
Is there any opportunity to find out what compilier is used to build standard 
binaries from http://www.postgresql.org/ftp/binary/v8.3.3/win32/
(postgresql-8.3.3-1-binaries-no-installer.zip
MSVC or MinGW(gcc)?
I have some problems with C-procedures compilation (PG 8.3, WinXP). I've got 
the information from mailing list (thanks to all who had answered) that the 
cause of these problems could be the using of different compiliers.
But now my library doesn't work correctly in both variants (MSVC and MinGW)... 
:(

Regards, Marina.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] C-procedure crashed in Postgres 8.3.3 when using 'text' variable (WinXP)

2008-07-15 Thread el dorado
I download ready binaries from 
http://www.postgresql.org/ftp/binary/v8.3.3/win32/
(postgresql-8.3.3-1-binaries-no-installer.zip)
So I didn't know exactly which compilier was used.
Are these binaries built by means of MSVC?

Regards, Marina.

> el dorado <[EMAIL PROTECTED]> writes:
> > I'd like to write C-function returning text for using in PG 8.3.3. (WinXP 
> > SP2)
> > For compilation I use MinGW-5.1.4 (gcc 3.4.5),MSYS-1.0.10.
> 
> Was the Postgres server you're using built the same way?  I seem to
> recall some incompatibilities between MinGW and MSVC builds.
> 
>   regards, tom lane
> 
> 

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] C-procedure crashed in Postgres 8.3.3 when using 'text' variable (WinXP)

2008-07-15 Thread el dorado
Hello!
I'd like to write C-function returning text for using in PG 8.3.3. (WinXP SP2)
For compilation I use MinGW-5.1.4 (gcc 3.4.5),MSYS-1.0.10.
The code looks like this (in reduced variant):

#include "postgres.h"
#include "fmgr.h"
#include "executor/executor.h" 
#include "utils/timestamp.h"
#include "utils/builtins.h"
#include "utils/formatting.h"

#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif

#define PG_CSTR_GET_TEXT(cstrp) \
DatumGetTextP(DirectFunctionCall1(textin, CStringGetDatum(cstrp)))

PG_FUNCTION_INFO_V1(SomeFunction);
Datum
SomeFunction(PG_FUNCTION_ARGS)
{
   PG_RETURN_TEXT_P(PG_CSTR_GET_TEXT("my_string"));
}

Then I create stored procedure in PG:

CREATE OR REPLACE FUNCTION "service"."some_function" () RETURNS text AS
 '$libdir/some_dll', 'SomeFunction'
 LANGUAGE C STRICT;

-
When I'm trying to use "service"."some_function" PG fails.

I tried to use the example from documentation:
PG_FUNCTION_INFO_V1(concat_text);

Datum
concat_text(PG_FUNCTION_ARGS)
{
text  *arg1 = PG_GETARG_TEXT_P(0);
text  *arg2 = PG_GETARG_TEXT_P(1);
int32 new_text_size = VARSIZE(arg1) + VARSIZE(arg2) - VARHDRSZ;
text *new_text = (text *) palloc(new_text_size);

SET_VARSIZE(new_text, new_text_size);
memcpy(VARDATA(new_text), VARDATA(arg1), VARSIZE(arg1) - VARHDRSZ);
memcpy(VARDATA(new_text) + (VARSIZE(arg1) - VARHDRSZ),
   VARDATA(arg2), VARSIZE(arg2) - VARHDRSZ);
PG_RETURN_TEXT_P(new_text);
}

CREATE FUNCTION concat_text(text, text) RETURNS text
 AS '$libdir/some_dll', 'concat_text'
 LANGUAGE C STRICT;

And I got the same result.

When I'm trying to return integer, f.e., evetything is fine.
Also all this examples worked fine with PostgreSQL 8.2.


I saw some similar problems - but I didn't find the solution (
http://archives.postgresql.org/pgsql-general/2008-05/msg00060.php
http://archives.postgresql.org/pgsql-general/2008-05/msg00097.php

Have somebody any ideas how to resolve this problem?

Thanks in advance,
Marina




-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general