pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedHow to create a new Table in prostgresql from a Webinterface
9+ messages / 8 participants
[nested] [flat]
* How to create a new Table in prostgresql from a Webinterface
@ 2004-08-14 15:15 Michelle Konzack <linux4michelle@freenet.de>
0 siblings, 2 replies; 9+ messages in thread
From: Michelle Konzack @ 2004-08-14 15:15 UTC (permalink / raw)
To: pgsql-php
Hello,
Never I have done this before (no need) but now I nee to create a
new table with some colums from a Webinterface and do not know how
to do that.
Please can anyone point me into the right direction ?
Thanks, Greetings
and nice Weekend
Michelle
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/3/88452356 67100 Strasbourg/France IRC #Debian (irc.icq.com)
Attachments:
signature.pgp (application/pgp-signature, 188B) download
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: How to create a new Table in prostgresql from a Webinterface
@ 2004-08-14 22:55 Raoul Buzziol <raoulus@libero.it>
parent: Michelle Konzack <linux4michelle@freenet.de>
1 sibling, 1 reply; 9+ messages in thread
From: Raoul Buzziol @ 2004-08-14 22:55 UTC (permalink / raw)
To: pgsql-php
Michelle Konzack wrote:
> Hello,
>
> Never I have done this before (no need) but now I nee to create a
> new table with some colums from a Webinterface and do not know how
> to do that.
You have to execute a query:
pg_query(connection, "CREATE TABLE tablename (id serial, val int4...);");
>
> Please can anyone point me into the right direction ?
>
> Thanks, Greetings
> and nice Weekend
> Michelle
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: How to create a new Table in prostgresql from a
@ 2004-08-15 17:28 Steve Bergman <steve@rueb.com>
parent: Michelle Konzack <linux4michelle@freenet.de>
1 sibling, 0 replies; 9+ messages in thread
From: Steve Bergman @ 2004-08-15 17:28 UTC (permalink / raw)
To: Michelle Konzack <linux4michelle@freenet.de>; +Cc: pgsql-php
On Sat, 2004-08-14 at 17:15 +0200, Michelle Konzack wrote:
> Hello,
>
> Never I have done this before (no need) but now I nee to create a
> new table with some colums from a Webinterface and do not know how
> to do that.
>
> Please can anyone point me into the right direction ?
Are you looking for something like this? I just knocked this out, so
I'm sure ther are syntax errors and whatnot, but it should give you an
idea.
Oh, and are mime attachments considered OK on this list? If not, my
apologies.
-Steve
Attachments:
create_table.php (application/x-php, 527B) download
webform.php (application/x-php, 396B) download
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: How to create a new Table in prostgresql from a Webinterface
@ 2004-08-16 17:11 Michelle Konzack <linux4michelle@freenet.de>
parent: Raoul Buzziol <raoulus@libero.it>
0 siblings, 4 replies; 9+ messages in thread
From: Michelle Konzack @ 2004-08-16 17:11 UTC (permalink / raw)
To: pgsql-php
Am 2004-08-15 00:55:34, schrieb Raoul Buzziol:
> Michelle Konzack wrote:
>
> > Hello,
> >
> > Never I have done this before (no need) but now I nee to create a
> > new table with some colums from a Webinterface and do not know how
> > to do that.
>
> You have to execute a query:
>
> pg_query(connection, "CREATE TABLE tablename (id serial, val int4...);");
:-/
I was looking for a php-Command or somthing like this to create the
table but not thinking on a pg_query WHICH execute the command...
Greetings
Michelle
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/3/88452356 67100 Strasbourg/France IRC #Debian (irc.icq.com)
Attachments:
signature.pgp (application/pgp-signature, 188B) download
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: How to create a new Table in prostgresql from a
@ 2004-08-16 17:31 Robby Russell <robby@planetargon.com>
parent: Michelle Konzack <linux4michelle@freenet.de>
3 siblings, 0 replies; 9+ messages in thread
From: Robby Russell @ 2004-08-16 17:31 UTC (permalink / raw)
To: Michelle Konzack <linux4michelle@freenet.de>; +Cc: pgsql-php
On Mon, 2004-08-16 at 10:11, Michelle Konzack wrote:
> Am 2004-08-15 00:55:34, schrieb Raoul Buzziol:
> > Michelle Konzack wrote:
> >
> > > Hello,
> > >
> > > Never I have done this before (no need) but now I nee to create a
> > > new table with some colums from a Webinterface and do not know how
> > > to do that.
> >
> > You have to execute a query:
> >
> > pg_query(connection, "CREATE TABLE tablename (id serial, val int4...);");
>
> :-/
>
> I was looking for a php-Command or somthing like this to create the
> table but not thinking on a pg_query WHICH execute the command...
>
Well, a CREATE TABLE is just another type of SQL Query that you can run.
It's not a 'command' exactly..just a query.
-Robby
--
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON | www.planetargon.com
* Portland, OR | robby@planetargon.com
* 503.351.4730 | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
****************************************/
Attachments:
signature.asc (application/pgp-signature, 188B) download
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: How to create a new Table in prostgresql from a Webinterface
@ 2004-08-16 17:36 Pedro B. <pedro.borracha@netcabo.pt>
parent: Michelle Konzack <linux4michelle@freenet.de>
3 siblings, 0 replies; 9+ messages in thread
From: Pedro B. @ 2004-08-16 17:36 UTC (permalink / raw)
To: Michelle Konzack <linux4michelle@freenet.de>; +Cc: pgsql-php
On php.net, if you did a search for pg_ , you would have seen the PHP
Function List .....
pg_close pg_connect pg_convert pg_copy_to
pg_dbname pg_delete pg_get_pid pg_host
pg_insert pg_lo_open pg_lo_read pg_lo_seek
pg_ping pg_port pg_query pg_select
pg_trace pg_tty pg_update preg_grep
\\pb
Michelle Konzack wrote:
> Am 2004-08-15 00:55:34, schrieb Raoul Buzziol:
>
>>Michelle Konzack wrote:
>>
>>
>>>Hello,
>>>
>>>Never I have done this before (no need) but now I nee to create a
>>>new table with some colums from a Webinterface and do not know how
>>>to do that.
>>
>>You have to execute a query:
>>
>>pg_query(connection, "CREATE TABLE tablename (id serial, val int4...);");
>
>
> :-/
>
> I was looking for a php-Command or somthing like this to create the
> table but not thinking on a pg_query WHICH execute the command...
>
>
> Greetings
> Michelle
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: How to create a new Table in prostgresql from a Webinterface
@ 2004-08-17 00:41 Todd Lewis <lewis-todd@comcast.net>
parent: Michelle Konzack <linux4michelle@freenet.de>
3 siblings, 1 reply; 9+ messages in thread
From: Todd Lewis @ 2004-08-17 00:41 UTC (permalink / raw)
To: pgsql-php
Just a followup question.
I'm fairly new to using PHP and pg. Security wise how could I limit a request such as
this? I'm assuming that if you have given a PHP user the ability to create tables, the
user also has the ability to truncate and delete tables as well.
> On php.net, if you did a search for pg_ , you would have seen the PHP
> Function List .....
>
> pg_close pg_connect pg_convert pg_copy_to
> pg_dbname pg_delete pg_get_pid pg_host
> pg_insert pg_lo_open pg_lo_read pg_lo_seek
> pg_ping pg_port pg_query pg_select
> pg_trace pg_tty pg_update preg_grep
>
>
> \\pb
>
> Michelle Konzack wrote:
> > Am 2004-08-15 00:55:34, schrieb Raoul Buzziol:
> >
> >>Michelle Konzack wrote:
> >>
> >>
> >>>Hello,
> >>>
> >>>Never I have done this before (no need) but now I nee to create a
> >>>new table with some colums from a Webinterface and do not know how
> >>>to do that.
> >>
> >>You have to execute a query:
> >>
> >>pg_query(connection, "CREATE TABLE tablename (id serial, val int4...);");
> >
> >
> > :-/
> >
> > I was looking for a php-Command or somthing like this to create the
> > table but not thinking on a pg_query WHICH execute the command...
> >
> >
> > Greetings
> > Michelle
> >
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: How to create a new Table in prostgresql from a Webinterface
@ 2004-08-17 01:20 Christopher Kings-Lynne <chriskl@familyhealth.com.au>
parent: Michelle Konzack <linux4michelle@freenet.de>
3 siblings, 0 replies; 9+ messages in thread
From: Christopher Kings-Lynne @ 2004-08-17 01:20 UTC (permalink / raw)
To: Michelle Konzack <linux4michelle@freenet.de>; +Cc: pgsql-php
>>pg_query(connection, "CREATE TABLE tablename (id serial, val int4...);");
>
>
> :-/
>
> I was looking for a php-Command or somthing like this to create the
> table but not thinking on a pg_query WHICH execute the command...
There is no such command.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: How to create a new Table in prostgresql from a
@ 2004-10-02 09:46 Frank Finner <postgresql@finner.de>
parent: Todd Lewis <lewis-todd@comcast.net>
0 siblings, 0 replies; 9+ messages in thread
From: Frank Finner @ 2004-10-02 09:46 UTC (permalink / raw)
To: Todd Lewis <lewis-todd@comcast.net>; +Cc: pgsql-php
On Mon, 16 Aug 2004 19:41:17 -0500 "Todd Lewis" <lewis-todd@comcast.net> sat
down, thought long and then wrote:
> Just a followup question.
>
> I'm fairly new to using PHP and pg. Security wise how could I limit a request
> such as this? I'm assuming that if you have given a PHP user the ability to
> create tables, the user also has the ability to truncate and delete tables as
> well.
>
A database user has not much in common with a PHP user (or a UNIX- or other
system user). The tables will be created with the database user you have
connected with (if you use authentication other than trust or ident, see
pg_hba.conf for details).
So if you create tables within PHP, you create them as the connecting database
user, and of course the creator may destroy them as well.
But if you have a database, in which the tables are owned by user A and you
connect with user B, user B may create tables owned by himself, but usually may
not drop tables owned by user A, if he has not explicitly been granted so.
What I do is: I have a database, in which all tables are owned by user A (a
superuser) and user B (the PHP connecting user) has the right to read, write,
update the tables, so he can work with them. But user B is not able to drop a
table of user A. User B, however, is allowed to create and drop his own tables,
if he likes.
If you connect every PHP user as a different database user, no database user is
able (if not explicitly granted) to drop other users“ tables. If not granted so,
he is not even able to touch them (he could see their existence, however).
Regards,
--
Frank Finner
Memory follows memory, memory defeats memory; some things are banished
only into the realms of our rich imaginings - but this does not mean
that they do not or cannot or will not exist - they exist! They exist!
(M. Moorcock, "The Revenge Of The Rose")
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2004-10-02 09:46 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-08-14 15:15 How to create a new Table in prostgresql from a Webinterface Michelle Konzack <linux4michelle@freenet.de>
2004-08-14 22:55 ` Raoul Buzziol <raoulus@libero.it>
2004-08-16 17:11 ` Michelle Konzack <linux4michelle@freenet.de>
2004-08-16 17:31 ` Re: How to create a new Table in prostgresql from a Robby Russell <robby@planetargon.com>
2004-08-16 17:36 ` Pedro B. <pedro.borracha@netcabo.pt>
2004-08-17 00:41 ` Todd Lewis <lewis-todd@comcast.net>
2004-10-02 09:46 ` Re: How to create a new Table in prostgresql from a Frank Finner <postgresql@finner.de>
2004-08-17 01:20 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
2004-08-15 17:28 ` Re: How to create a new Table in prostgresql from a Steve Bergman <steve@rueb.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox