How to create c language in postgresql database. Thanks.
I need to create c language in the postgresql database. I only know to
create as follows.
Create language c ;
Is there anything else I need to do before I create the C language?
Thanks.
Regards.
Grace
--
View this message in context: http://postgresql.1045698.n5.nabble.com/How-to-create-c-language-in-postgresql-database-Thanks-tp5712221.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
On 12/06/2012 17:53, leaf_yxj wrote:
I need to create c language in the postgresql database. I only know
to create as follows.Create language c ;
Is there anything else I need to do before I create the C language?
Hello Grace,
C isn't available (AFAIK) as a procedural language; however, you have a
wide choice of other languages to choose from - see the docs under
"Server programming" for some of them.
In fact, C is the language used to write PostgreSQL.
Ray.
--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie
leaf_yxj <leaf_yxj@163.com> writes:
I need to create c language in the postgresql database.
Why do you think you need to do that? It's built-in.
regards, tom lane
On 06/12/12 9:53 AM, leaf_yxj wrote:
I need to create c language in the postgresql database. I only know to
create as follows.Create language c ;
to clarify what tom said, you externally compile your C functions into
.so/.dll files, then bind them in with CREATE FUNCTION name(args)
RETURNS ..... AS 'path/filename' LANGUAGE C
see http://www.postgresql.org/docs/current/static/xfunc-c.html
--
john r pierce N 37, W 122
santa cruz ca mid-left coast
Hi Tom,
Thanks. You guys are right. I check the database. The C programm is there. ----- but why our application team keep ask me to give them the superuser privileges to create the C function. Should they use the superuser to create the C function. if yes , why they need it?
Thanks.
Regards.
Grace
At 2012-06-13 01:55:52,"Tom Lane" <tgl@sss.pgh.pa.us> wrote:
Show quoted text
leaf_yxj <leaf_yxj@163.com> writes:
I need to create c language in the postgresql database.
Why do you think you need to do that? It's built-in.
regards, tom lane
Hi Raymond,
Thanks. You guys are right. I check the database. The C programm is there. ----- but why our application team keep ask me to give them the superuser privileges to create the C function. Should they use the superuser to create the C function. if yes , why they need it?
Thanks.
Regards.
Grace
At 2012-06-13 01:35:49,"Raymond O'Donnell [via PostgreSQL]" <ml-node+s1045698n5712228h10@n5.nabble.com> wrote:
On 12/06/2012 17:53, leaf_yxj wrote:
I need to create c language in the postgresql database. I only know
to create as follows.Create language c ;
Is there anything else I need to do before I create the C language?
Hello Grace,
C isn't available (AFAIK) as a procedural language; however, you have a
wide choice of other languages to choose from - see the docs under
"Server programming" for some of them.
In fact, C is the language used to write PostgreSQL.
Ray.
--
Raymond O'Donnell :: Galway :: Ireland
[hidden email]
--
Sent via pgsql-general mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
If you reply to this email, your message will be added to the discussion below:
http://postgresql.1045698.n5.nabble.com/How-to-create-c-language-in-postgresql-database-Thanks-tp5712221p5712228.html
To unsubscribe from How to create c language in postgresql database. Thanks., click here.
NAML
--
View this message in context: http://postgresql.1045698.n5.nabble.com/How-to-create-c-language-in-postgresql-database-Thanks-tp5712221p5712240.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
Hi John,
Thanks. You guys are right. I check the database. The C programm is there. ----- but why our application team keep ask me to give them the superuser privileges to create the C function. Should they use the superuser to create the C function. if yes , why they need it?
Thanks.
Regards.
Grace
At 2012-06-13 02:14:06,"John R Pierce [via PostgreSQL]" <ml-node+s1045698n5712238h20@n5.nabble.com> wrote:
On 06/12/12 9:53 AM, leaf_yxj wrote:
I need to create c language in the postgresql database. I only know to
create as follows.Create language c ;
to clarify what tom said, you externally compile your C functions into
.so/.dll files, then bind them in with CREATE FUNCTION name(args)
RETURNS ..... AS 'path/filename' LANGUAGE C
see http://www.postgresql.org/docs/current/static/xfunc-c.html
--
john r pierce N 37, W 122
santa cruz ca mid-left coast
--
Sent via pgsql-general mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
If you reply to this email, your message will be added to the discussion below:
http://postgresql.1045698.n5.nabble.com/How-to-create-c-language-in-postgresql-database-Thanks-tp5712221p5712238.html
To unsubscribe from How to create c language in postgresql database. Thanks., click here.
NAML
--
View this message in context: http://postgresql.1045698.n5.nabble.com/How-to-create-c-language-in-postgresql-database-Thanks-tp5712221p5712242.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
Hi Tom,
Thanks. You guys are right. I check the database. The C programm is there.
----- but why our application team keep ask me to give them the superuser
privileges to create the C function. Should they use the superuser to create
the C function. if yes , why they need it?
Thanks.
Regards.
Grace
--
View this message in context: http://postgresql.1045698.n5.nabble.com/How-to-create-c-language-in-postgresql-database-Thanks-tp5712221p5712244.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
On 06/12/12 11:25 AM, leaf_yxj wrote:
Thanks. You guys are right. I check the database. The C programm is
there. ----- but why our application team keep ask me to give them
the superuser privileges to create the C function. Should they use the
superuser to create the C function. if yes , why they need it?
yes, only a sql superuser can define a C function, as these have total
access to crashing postgres's innards.
--
john r pierce N 37, W 122
santa cruz ca mid-left coast
John,
So can I ( the superuser) do it by myself and how can I do it?
Thanks.
Grace
At 2012-06-13 02:48:20,"John R Pierce [via PostgreSQL]" <ml-node+s1045698n5712251h23@n5.nabble.com> wrote:
On 06/12/12 11:25 AM, leaf_yxj wrote:
Thanks. You guys are right. I check the database. The C programm is
there. ----- but why our application team keep ask me to give them
the superuser privileges to create the C function. Should they use the
superuser to create the C function. if yes , why they need it?
yes, only a sql superuser can define a C function, as these have total
access to crashing postgres's innards.
--
john r pierce N 37, W 122
santa cruz ca mid-left coast
--
Sent via pgsql-general mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
If you reply to this email, your message will be added to the discussion below:
http://postgresql.1045698.n5.nabble.com/How-to-create-c-language-in-postgresql-database-Thanks-tp5712221p5712251.html
To unsubscribe from How to create c language in postgresql database. Thanks., click here.
NAML
--
View this message in context: http://postgresql.1045698.n5.nabble.com/How-to-create-c-language-in-postgresql-database-Thanks-tp5712221p5712254.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
On 06/12/12 12:04 PM, leaf_yxj wrote:
So can I ( the superuser) do it by myself and how can I do it?
the devs would give you the .dll/.so file, and a .sql scrap to do the
install. you'd put the .so/.dll in an appropriate place, and run the
.sql scrap to install it into a given database.
--
john r pierce N 37, W 122
santa cruz ca mid-left coast
Hi John,
one more question: so it's one time jobs or it need keep doing.
Thanks.
Grace
At 2012-06-13 02:48:20,"John R Pierce [via PostgreSQL]" <ml-node+s1045698n5712251h23@n5.nabble.com> wrote:
On 06/12/12 11:25 AM, leaf_yxj wrote:
Thanks. You guys are right. I check the database. The C programm is
there. ----- but why our application team keep ask me to give them
the superuser privileges to create the C function. Should they use the
superuser to create the C function. if yes , why they need it?
yes, only a sql superuser can define a C function, as these have total
access to crashing postgres's innards.
--
john r pierce N 37, W 122
santa cruz ca mid-left coast
--
Sent via pgsql-general mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
If you reply to this email, your message will be added to the discussion below:
http://postgresql.1045698.n5.nabble.com/How-to-create-c-language-in-postgresql-database-Thanks-tp5712221p5712251.html
To unsubscribe from How to create c language in postgresql database. Thanks., click here.
NAML
--
View this message in context: http://postgresql.1045698.n5.nabble.com/How-to-create-c-language-in-postgresql-database-Thanks-tp5712221p5712255.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
On 06/12/12 12:07 PM, leaf_yxj wrote:
one more question: so it's one time jobs or it need keep doing.
each time the C function is updated, you would need to DROP FUNCTION /
replace binary / CREATE FUNCTION in any database that needs it. and
each time you create a new database that needs it, you'd need to CREATE
FUNCTION
--
john r pierce N 37, W 122
santa cruz ca mid-left coast
Hi John,
Thanks for your quick reply. It's really help me a lot.
1) What's the info in .dll/.so ?
2) .sql scrap is the binary installation file?
3) For the same database, we need update C functions frequently ?
Thanks.
Regards.
Grace
At 2012-06-13 03:08:26,"John R Pierce [via PostgreSQL]" <ml-node+s1045698n5712256h78@n5.nabble.com> wrote:
On 06/12/12 12:04 PM, leaf_yxj wrote:
So can I ( the superuser) do it by myself and how can I do it?
the devs would give you the .dll/.so file, and a .sql scrap to do the
install. you'd put the .so/.dll in an appropriate place, and run the
.sql scrap to install it into a given database.
--
john r pierce N 37, W 122
santa cruz ca mid-left coast
--
Sent via pgsql-general mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
If you reply to this email, your message will be added to the discussion below:
http://postgresql.1045698.n5.nabble.com/How-to-create-c-language-in-postgresql-database-Thanks-tp5712221p5712256.html
To unsubscribe from How to create c language in postgresql database. Thanks., click here.
NAML
--
View this message in context: http://postgresql.1045698.n5.nabble.com/How-to-create-c-language-in-postgresql-database-Thanks-tp5712221p5712259.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
On 06/12/12 12:22 PM, leaf_yxj wrote:
1) What's the info in .dll/.so ?
thats the binary code compiled and linked from C, windows calls this
DLL (Dynamic Link Library), while unix usually calls it SO (Shared
Object). Mac OSX has yet another name (dylib or something).
2) .sql scrap is the binary installation file?
the .sql is the CREATE FUNCTION statement mostly.
3) For the same database, we need update C functions frequently ?
you tell me? how often do your programmers change them?
--
john r pierce N 37, W 122
santa cruz ca mid-left coast
Hi John,
Thanks for your useful info. I really apprecaite it. I got this problem when the SAS application try to install the scoring model. So I am very confused.
1) What's the info in .dll/.so ?
thats the binary code compiled and linked from C, windows calls this
DLL (Dynamic Link Library), while unix usually calls it SO (Shared
Object). Mac OSX has yet another name (dylib or something).
---- Grace comments : this need the superuser privileges on the server to copy those .so ( we are on the linux server) to the postgresql server ?
correct ????
2) .sql scrap is the binary installation file?
the .sql is the CREATE FUNCTION statement mostly.
--- Grace comments : we already grant create privileges on the saslib schema. So it means they can this scrap by themselves ???
3) For the same database, we need update C functions frequently ?
you tell me? how often do your programmers change them?
---- Grace commends : they tried to SAS to create lot of models. So I amn't sure about this issues. But John, thanks a lot for your answers.
Thanks.
Regards.
Grace
At 2012-06-13 03:27:45,"John R Pierce [via PostgreSQL]" <ml-node+s1045698n5712261h33@n5.nabble.com> wrote:
On 06/12/12 12:22 PM, leaf_yxj wrote:
1) What's the info in .dll/.so ?
thats the binary code compiled and linked from C, windows calls this
DLL (Dynamic Link Library), while unix usually calls it SO (Shared
Object). Mac OSX has yet another name (dylib or something).
2) .sql scrap is the binary installation file?
the .sql is the CREATE FUNCTION statement mostly.
3) For the same database, we need update C functions frequently ?
you tell me? how often do your programmers change them?
--
john r pierce N 37, W 122
santa cruz ca mid-left coast
--
Sent via pgsql-general mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
If you reply to this email, your message will be added to the discussion below:
http://postgresql.1045698.n5.nabble.com/How-to-create-c-language-in-postgresql-database-Thanks-tp5712221p5712261.html
To unsubscribe from How to create c language in postgresql database. Thanks., click here.
NAML
--
View this message in context: http://postgresql.1045698.n5.nabble.com/How-to-create-c-language-in-postgresql-database-Thanks-tp5712221p5712264.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
On 06/13/2012 03:35 AM, leaf_yxj wrote:
Hi John,
Thanks for your useful info. I really apprecaite it. I got this
problem when the SAS application try to install the scoring model. So
I am very confused.1) What's the info in .dll/.so ?
thats the binary code compiled and linked from C, windows calls this
DLL (Dynamic Link Library), while unix usually calls it SO (Shared
Object). Mac OSX has yet another name (dylib or something).
---- Grace comments : this need the superuser privileges on the server
to copy those .so ( we are on the linux server) to the postgresql
server ?
correct ????
And to dynamically link them into the PostgreSQL executable to run them.
Most importantly, you have to COMPLTELY AND UTTERLY TRUST YOUR DEV TEAM.
If you let them install a C library they've written, you've given them
total power over your database, so they can just use their C function to
give themselves superuser privs if they want it. This isn't a bad thing;
C functions are extremely fast and powerful tools in a database, you
just have to trust the person or people who wrote them.
A C library also has much greater opportunity to muck up your database.
In particular it can crash database backends very easily. You need to
know the people who wrote it are competent and tested it well in a
non-production environment.
You need to read about "dlopen" or "LoadLibrary", about dynamic linking,
about compilation and shared libraries in C, etc. Right now you don't
have the background in how this works to make appropriate decisions; you
have to either trust your dev team to do the right thing, or tell them
to do what they need to without using a C library and accept that may
mean you're stopping them from doing their jobs properly.
2) .sql scrap is the binary installation file?
the .sql is the CREATE FUNCTION statement mostly. --- Grace comments : we already grant create privileges on the saslib schema. So it means they can this scrap by themselves ???
No, you have to be a superuser to install C functions, because they have
*total* access to all of PostgreSQL and can bypass all security and
authentication completely.
--
Craig Ringer
On Tue, Jun 12, 2012 at 11:47 AM, John R Pierce <pierce@hogranch.com> wrote:
On 06/12/12 11:25 AM, leaf_yxj wrote:
Thanks. You guys are right. I check the database. The C programm is there.
----- but why our application team keep ask me to give them the superuser
privileges to create the C function. Should they use the superuser to create
the C function. if yes , why they need it?yes, only a sql superuser can define a C function, as these have total
access to crashing postgres's innards.
Not just the innards, but the file system (could be used to overwrite
data files), arbitrary system commands, etc......
Best Wishes,
Chris Travers
On 06/13/2012 12:45 PM, Chris Travers wrote:
On Tue, Jun 12, 2012 at 11:47 AM, John R Pierce <pierce@hogranch.com> wrote:
On 06/12/12 11:25 AM, leaf_yxj wrote:
Thanks. You guys are right. I check the database. The C programm is there.
----- but why our application team keep ask me to give them the superuser
privileges to create the C function. Should they use the superuser to create
the C function. if yes , why they need it?yes, only a sql superuser can define a C function, as these have total
access to crashing postgres's innards.Not just the innards, but the file system (could be used to overwrite
data files), arbitrary system commands, etc......
Hopefully not arbitrary system commands, in that I really hope nobody's
nuts enough to run PostgreSQL as root or with write access to its own
binaries. The data files are fair game, though, and
replacement/modification of commands is probably possible in weaker
installations.
--
Craig Ringer
On Wed, Jun 13, 2012 at 12:19 AM, Craig Ringer <ringerc@ringerc.id.au> wrote:
On 06/13/2012 12:45 PM, Chris Travers wrote:
On Tue, Jun 12, 2012 at 11:47 AM, John R Pierce <pierce@hogranch.com>
wrote:On 06/12/12 11:25 AM, leaf_yxj wrote:
Thanks. You guys are right. I check the database. The C programm is
there.
----- but why our application team keep ask me to give them the
superuser
privileges to create the C function. Should they use the superuser to
create
the C function. if yes , why they need it?yes, only a sql superuser can define a C function, as these have total
access to crashing postgres's innards.Not just the innards, but the file system (could be used to overwrite
data files), arbitrary system commands, etc......Hopefully not arbitrary system commands, in that I really hope nobody's nuts
enough to run PostgreSQL as root or with write access to its own binaries.
The data files are fair game, though, and replacement/modification of
commands is probably possible in weaker installations.
Maybe not as arbitrary as it would as root, but at least arbitrary in
the sense of "able to do or access anything that the system will let
the Postgres process access." That means all binaries an ordinary
user can access and all system calls that don't require root unless
you lock things down using something like SELinux.....
Best Wishes,
Chris Travers