[SQL] php to pgsql question

2008-03-04 Thread li ethan
HI guys!
I've been encounting a problem when I configured PHP to support
Postgres.I think may be someone in here can solve my problem.
Postgres version is 8.1.4,and the install path is /usr/local/pgsql, PHP
is 4.4.2.
I use this parameter to configure PHP--with-pgsql=/usr/local/pgsql
(I also try /usr/local, /usr/local/lib,etc. still do not work)
when I run make,I get this error message:
main/internal_functions_cli.lo(.data.rel+0x28): undefined reference to
`pgsql_module_entry' collect2: ld returned 1 exit status make: ***
[sapi/cli/php] Error 1

  Anyone know what the problem is? And how to solve it?

  Thanks in advance!


Re: [SQL] php to pgsql question

2008-03-04 Thread Leif B. Kristensen
On Tuesday 4. March 2008, li ethan wrote:
>HI guys!
>I've been encounting a problem when I configured PHP to support
>Postgres.I think may be someone in here can solve my problem.
>Postgres version is 8.1.4,and the install path is
> /usr/local/pgsql, PHP is 4.4.2.
>I use this parameter to configure PHP   
> --with-pgsql=/usr/local/pgsql (I also try /usr/local,
> /usr/local/lib,etc. still do not work) when I run make,I get this
> error message:
>main/internal_functions_cli.lo(.data.rel+0x28): undefined
> reference to `pgsql_module_entry' collect2: ld returned 1 exit
> status make: *** [sapi/cli/php] Error 1
>
>  Anyone know what the problem is? And how to solve it?
>
>  Thanks in advance!

It's dependent on the libpq library. Do you have that installed?
-- 
Leif Biberg Kristensen | Registered Linux User #338009
http://solumslekt.org/ | Cruising with Gentoo/KDE
My Jazz Jukebox: http://www.last.fm/user/leifbk/

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your Subscription:
http://mail.postgresql.org/mj/mj_wwwusr?domain=postgresql.org&extra=pgsql-sql


Re: [SQL] compiling plpython compilation error (solved)

2008-03-04 Thread Gerardo Herzig

Tom Lane wrote:


Gerardo Herzig <[EMAIL PROTECTED]> writes:
 


Hi all. Im having a hard time trying to compile the plpython package.
This is the error make gives me:
   



 

/usr/lib/python2.5/config/libpython2.5.a(abstract.o): relocation 
R_X86_64_32 against `a local symbol' can not be used when making a 
shared object; recompile with -fPIC
   



Well, I'd try following the error message's advice: use -fPIC not
-fpic.  Note that it's not real clear whether this needs to be done
for plpython, or libpython, or perhaps both; so you might well be
in for making a custom libpython installation.

regards, tom lane


 

Yes, i was trying to recompile plpy with -fPIC with no success, 
recompiling *python* with -fPIC did work.


Thanks!!
Gerardo

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your Subscription:
http://mail.postgresql.org/mj/mj_wwwusr?domain=postgresql.org&extra=pgsql-sql


Re: [SQL] Documenting a DB schema

2008-03-04 Thread Emi Lu

Hi,


I'm looking for a systematic way to document the schema for the database
behind our website (www.redfin.com  ), so that
the developers using this database have a better idea what all the
tables and columns mean and what data to expect.  Any recommendations?


I am using Case Studio to document DB structures. I think it is pretty 
good tool.


http://www.casestudio.com/enu/default.aspx

To browse DB objects only, try DbVisualizer:
http://www.minq.se/products/dbvis/

- Ly

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your Subscription:
http://mail.postgresql.org/mj/mj_wwwusr?domain=postgresql.org&extra=pgsql-sql


[SQL] Documenting a DB schema

2008-03-04 Thread Shahaf Abileah
I'm looking for a systematic way to document the schema for the database
behind our website (www.redfin.com  ), so that
the developers using this database have a better idea what all the
tables and columns mean and what data to expect.  Any recommendations?

 

It would be great if the documentation could be kept as close to the
code as possible - that way we stand a chance of keeping it up to date.
So, in the same way that Java docs go right there on top of the class or
method definitions, it would be great if I could attach my comments to
the table definitions. It looks like MySQL has that kind of capability:

 

create table table_with_comments(a int comment 'this is
column a...');

 

(see http://dev.mysql.com/doc/refman/5.0/en/create-table.html)

 

However, Postgres doesn't support the "comment" keyword.  Is there an
alternative?

 

Thanks,

 

--S

 

Shahaf Abileah | Lead Software Developer 

[EMAIL PROTECTED] | tel: 206.859.2869 | fax: 877.733.3469

Redfin Corporation
710 2nd Ave
Suite 600
Seattle, WA 98104

 



Re: [SQL] Documenting a DB schema

2008-03-04 Thread Steve Crawford

Shahaf Abileah wrote:


I'm looking for a systematic way to document the schema for the 
database behind our website (www.redfin.com ), 
so that the developers using this database have a better idea what all 
the tables and columns mean and what data to expect.  Any recommendations?


 

It would be great if the documentation could be kept as close to the 
code as possible -- that way we stand a chance of keeping it up to 
date.  So, in the same way that Java docs go right there on top of the 
class or method definitions, it would be great if I could attach my 
comments to the table definitions. It looks like MySQL has that kind 
of capability:


 

create table table_with_comments(a int comment 'this is 
column a...');


 


(see http://dev.mysql.com/doc/refman/5.0/en/create-table.html)

 

However, Postgres doesn't support the "comment" keyword.  Is there an 
alternative?



You mean like:
COMMENT ON mytable IS 'This is my table. Mine, mine, mine';

You can also comment columns, databases, functions, schemas, domains, etc.

Cheers,
Steve



[SQL] using copy from in function

2008-03-04 Thread Yura Gal
I'm trying to automate import data using CORY FROM. For this purpose I
wrote plpgsql function. As my postgres works on windows vista I need
to use E'' syntax for path-to-file. This syntax works fine in SQL
queries like:
COPY table FROM E'path_to_file_with_double_backslashes';

Following query works fine too:
COPY table FROM $$path_to_file_with_single_backslashes$$;

However I can't figure it out how to use file_path variable as this
code throw error while compilation:

CREATE OR REPLACE FUNCTION func (inout _chrom varchar) RETURNS varchar AS
$body$
DECLARE
  _chrom ALIAS FOR $1;
  _file TEXT;
BEGIN
  _file := $$c:\folder1\folder2\$$ || _chrom || '.txt';
  RAISE NOTICE 'Filename is -> %', _file;
  COPY table (column) FROM _file CSV HEADER;

  statements;

EXCEPTION
WHEN bad_copy_file_format THEN
_chrom := 'badformat';
WHEN io_error THEN
_chrom := 'ioerr';
WHEN undefined_file THEN
_chrom := 'unfile';
RETURN;
END;
$body$
LANGUAGE 'plpgsql' ;

ERROR: syntax error in query at or near "$1" at character 35
QUERY:   COPY table (column) FROM $1 CSV HEADER
CONTEXT: SQL statement in PL/PgSQL function "func" near line 7

Is there any tricks to solve this problem? I suspect that something
wrong with quotation but can not find out a mistake.

PS. Postgres server version is 8.3

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your Subscription:
http://mail.postgresql.org/mj/mj_wwwusr?domain=postgresql.org&extra=pgsql-sql


Re: [SQL] using copy from in function

2008-03-04 Thread Osvaldo Kussama
2008/3/4, Yura Gal <[EMAIL PROTECTED]>:
> I'm trying to automate import data using CORY FROM. For this purpose I
>  wrote plpgsql function. As my postgres works on windows vista I need
>  to use E'' syntax for path-to-file. This syntax works fine in SQL
>  queries like:
>  COPY table FROM E'path_to_file_with_double_backslashes';
>
>  Following query works fine too:
>  COPY table FROM $$path_to_file_with_single_backslashes$$;
>
>  However I can't figure it out how to use file_path variable as this
>  code throw error while compilation:
>
>  CREATE OR REPLACE FUNCTION func (inout _chrom varchar) RETURNS varchar AS
>  $body$
>  DECLARE
>   _chrom ALIAS FOR $1;
>   _file TEXT;
>  BEGIN
>   _file := $$c:\folder1\folder2\$$ || _chrom || '.txt';
>   RAISE NOTICE 'Filename is -> %', _file;
>   COPY table (column) FROM _file CSV HEADER;
>
>   statements;
>
>  EXCEPTION
>  WHEN bad_copy_file_format THEN
> _chrom := 'badformat';
>  WHEN io_error THEN
> _chrom := 'ioerr';
>  WHEN undefined_file THEN
> _chrom := 'unfile';
> RETURN;
>  END;
>  $body$
>  LANGUAGE 'plpgsql' ;
>
>  ERROR: syntax error in query at or near "$1" at character 35
>  QUERY:   COPY table (column) FROM $1 CSV HEADER
>  CONTEXT: SQL statement in PL/PgSQL function "func" near line 7
>
>  Is there any tricks to solve this problem? I suspect that something
>  wrong with quotation but can not find out a mistake.
>
>  PS. Postgres server version is 8.3
>
>


Try:
EXECUTE 'COPY table (column) FROM ' || _file || 'CSV HEADER;';

Osvaldo

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your Subscription:
http://mail.postgresql.org/mj/mj_wwwusr?domain=postgresql.org&extra=pgsql-sql