Re: [SQL] Create table command fails with permission denied

2009-08-05 Thread Venkateswara Rao Bondada
Lane [mailto:t...@sss.pgh.pa.us] Sent: Wednesday, August 05, 2009 6:46 AM To: Venkateswara Rao Bondada Cc: Rob Sargent; pgsql-sql@postgresql.org Subject: Re: [SQL] Create table command fails with permission denied Venkateswara Rao Bondada writes: > camd=# \c cms postgres > You are now c

Re: [SQL] Create table command fails with permission denied

2009-08-04 Thread Tom Lane
Venkateswara Rao Bondada writes: > camd=# \c cms postgres > You are now connected to database "cms" as user "postgres". > cms=# create table test(id character varying(80)); > ERROR: could not create relation "test": Permission denied Actually, what that is complaining about is that the operating

Re: [SQL] Create table command fails with permission denied

2009-08-04 Thread Venkateswara Rao Bondada
mission denied cms=# == Thanks, Venkat -Original Message- From: Rob Sargent [mailto:robjsarg...@gmail.com] Sent: Tuesday, August 04, 2009 3:33 AM To: Venkateswara Rao Bondada Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Create table command f

Re: [SQL] Create table command fails with permission denied

2009-08-04 Thread Rob Sargent
---Original Message- From: Rob Sargent [mailto:robjsarg...@gmail.com] Sent: Tuesday, August 04, 2009 3:33 AM To: Venkateswara Rao Bondada Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Create table command fails with permission denied Looks to me as though you are not the owner of the schema

Re: [SQL] Create table command fails with permission denied

2009-08-03 Thread Rob Sargent
Looks to me as though you are not the owner of the schema nor superuser nor in a role with permission to create tables in said schema. See the DBA if it's not you. If it is sign on as postgres (superuser) and grant yourself some access rights. Venkateswara Rao Bondada wrote: Hi, I’m new t

[SQL] Create table command fails with permission denied

2009-08-03 Thread Venkateswara Rao Bondada
Hi, I'm new to PostgreSQL, and currently facing an issue with PostgreSQL 7.4 database. I'm getting the following error when tried to create a table. Please let me know the steps (with queries) that I should take care to resolve this issue. cms=# create table test(id character varying(80)); ERRO

Re: [SQL] create table with rownames as values in column of seciond table

2008-12-15 Thread George Pavlov
' text' from foo),', ')||');'; not pretty, but you get the idea. > -Original Message- > From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql- > ow...@postgresql.org] On Behalf Of Marco Lechner > Sent: Monday, December 15, 2008 1:42 PM > To: p

[SQL] create table with rownames as values in column of seciond table

2008-12-15 Thread Marco Lechner
Hi list, I try to create a table using plpgsql or plpythonu. I'm starting with programming in postgresql therfore I'm a little bit confused. I know a little bit of python and a little bit of SQL. May be some hints could help me gettin into it: My problem is: I'm having a table with a column a and

Re: [SQL] Create Table Problem

2008-06-13 Thread Volkan YAZICI
"Shavonne Marietta Wijesinghe" <[EMAIL PROTECTED]> writes: > IF (table not found) THEN > CREATE TABLE distributors ( > did integer, > namevarchar(40), > UNIQUE(name) > ); > END IF Assuming you're in a procedure (above code snippet looks to be executed within

[SQL] Create Table Problem

2008-06-13 Thread Shavonne Marietta Wijesinghe
Hello I'm having some trouble checking if a table exist before i create it. Example: SELECT * FROM distributors IF (table not found) THEN CREATE TABLE distributors ( did integer, namevarchar(40), UNIQUE(name) ); END IF If i have a table like the above h

Re: [SQL] Create Table xtest (like xtype)

2008-02-06 Thread TJ O'Donnell
Considering how related Created Types and Tables are (at least conceptually) it seems like a good idea to allow Created Types to be used in the Like clause. At least it would help me and make maintaining my db easier and cleaner. TJ O'Donnell http://www.gnova.com/ > "TJ O'Donnell" <[EMAIL PROTECT

Re: [SQL] Create Table xtest (like xtype)

2008-02-06 Thread Tom Lane
"TJ O'Donnell" <[EMAIL PROTECTED]> writes: > Create Type xtype As (a Integer, b Text); > Create Table xtest (Like xtype); > ERROR: "xtype" is a composite type Hmmm ... as you see, that's disallowed, but offhand it seems like it wouldn't be very hard to allow it. It might be as simple as relaxing

[SQL] Create Table xtest (like xtype)

2008-02-06 Thread TJ O'Donnell
I know I can create a table using names and types from an existing table. Create Table xtable (a Integer, b Text); Create Table xtest (Like xtable); This works just fine. I want to create a table having the same column names and types as an existing new datatype. Create Type xtype As (a Intege

Re: [SQL] CREATE TABLE

2007-03-09 Thread Bart Degryse
Because being consistent is easily overlooked I would advise not to quote the table names Instead of calling your table thisTableIsBig call it this_table_is_big >>> Andrew Sullivan <[EMAIL PROTECTED]> 2007-03-09 15:21 >>> On Fri, Mar 09, 2007 at 02:56:06PM +0100, Shavonne Marietta Wijesinghe wr

Re: Fw: [SQL] CREATE TABLE

2007-03-09 Thread Andrew Sullivan
On Fri, Mar 09, 2007 at 03:15:54PM +0100, Shavonne Marietta Wijesinghe wrote: > The problem i'm having is i can't pass them in the strSQL string. coz when > i write " i close the string :\ You likely need to escape the double-quotes. How you do it in your environment is a topic for the manuals f

Re: [SQL] CREATE TABLE

2007-03-09 Thread Andrew Sullivan
On Fri, Mar 09, 2007 at 02:56:06PM +0100, Shavonne Marietta Wijesinghe wrote: > > But the problem i have is that when i go and open my database in > pgadmin the table name and coloumn name is written in lowercase :( Unquoted identifiers in PostgreSQL are folded to lower case. This is contrary to

Re: [SQL] CREATE TABLE

2007-03-09 Thread Milen A. Radev
Shavonne Marietta Wijesinghe wrote: > Hello > > From my asp page i create a table > > TableName = "CON01" > strSQL = "CREATE TABLE " & TableName & " ( ID text, N_GEN serial not > null);" > > But the problem i have is that when i go and open my database in pgadmin the > table name and colou

Fw: [SQL] CREATE TABLE

2007-03-09 Thread Shavonne Marietta Wijesinghe
c: "Shavonne Marietta Wijesinghe" <[EMAIL PROTECTED]> Sent: Friday, March 09, 2007 3:09 PM Subject: Re: [SQL] CREATE TABLE On 3/9/07, Shavonne Marietta Wijesinghe <[EMAIL PROTECTED]> wrote: Hello From my asp page i create a table TableName = "CON01" strSQL = "C

Fw: [SQL] CREATE TABLE

2007-03-09 Thread Shavonne Marietta Wijesinghe
León" <[EMAIL PROTECTED]> To: Cc: "Shavonne Marietta Wijesinghe" <[EMAIL PROTECTED]> Sent: Friday, March 09, 2007 3:09 PM Subject: Re: [SQL] CREATE TABLE On 3/9/07, Shavonne Marietta Wijesinghe <[EMAIL PROTECTED]> wrote: Hello From my asp page i create a

Re: [SQL] CREATE TABLE

2007-03-09 Thread Rodrigo De León
On 3/9/07, Shavonne Marietta Wijesinghe <[EMAIL PROTECTED]> wrote: Hello From my asp page i create a table TableName = "CON01" strSQL = "CREATE TABLE " & TableName & " ( ID text, N_GEN serial not null);" But the problem i have is that when i go and open my database in pgadmin the table nam

[SQL] CREATE TABLE

2007-03-09 Thread Shavonne Marietta Wijesinghe
Hello >From my asp page i create a table TableName = "CON01" strSQL = "CREATE TABLE " & TableName & " ( ID text, N_GEN serial not null);" But the problem i have is that when i go and open my database in pgadmin the table name and coloumn name is written in lowercase :( How do i ask it to

Re: [SQL] CREATE TABLE AS inside of a function

2006-07-24 Thread Stephan Szabo
On Mon, 24 Jul 2006, Kevin Nikiforuk wrote: > So, I've changed my code as Erik suggested: > > CREATE OR REPLACE FUNCTION rgio() RETURNS INTEGER as $$ > DECLARE > lv RECORD; > > BEGIN > FOR lv IN SELECT DISTINCT rg > FROM ldevrg > LOOP > >

Re: [SQL] CREATE TABLE AS inside of a function

2006-07-24 Thread Kevin Nikiforuk
near line 23 psql:rgio.sql:32: LINE 1: SELECT 'CREATE TABLE rgio_' || $ $1 || ' AS psql:rgio.sql:32: ^ From: [EMAIL PROTECTED] on behalf of Erik Jones Sent: Fri 7/21/2006 3:04 PM To:

Re: [SQL] CREATE TABLE AS inside of a function

2006-07-21 Thread Erik Jones
Rodrigo De Leon wrote: On 7/21/06, Kevin Nikiforuk <[EMAIL PROTECTED]> wrote: So now that I've got my loops working, on to my next newbie question. I've created my function and in it, I want to loop through the results of a select and for each value of my loop counter, I want to create a new

Re: [SQL] CREATE TABLE AS inside of a function

2006-07-21 Thread Rodrigo De Leon
On 7/21/06, Kevin Nikiforuk <[EMAIL PROTECTED]> wrote: So now that I've got my loops working, on to my next newbie question. I've created my function and in it, I want to loop through the results of a select and for each value of my loop counter, I want to create a new table, but I can't figu

[SQL] CREATE TABLE AS inside of a function

2006-07-21 Thread Kevin Nikiforuk
So now that I've got my loops working, on to my next newbie question. I've created my function and in it, I want to loop through the results of a select and for each value of my loop counter, I want to create a new table, but I can't figure out how to use a variable in the name of the new table

Re: [SQL] CREATE TABLE AS and tablespaces

2006-02-24 Thread Bruce Momjian
Markus Schaber wrote: > Hello, > > Recently, I wanted to create a table from a complex query in a specific > tablespace, but CREATE TABLE name AS SELECT ... does not accept a > tablespace argument. > > I worked around it by CREATE TABLE name AS SELECT ... LIMIT 0, then > moving the generated tabl

[SQL] CREATE TABLE AS and tablespaces

2006-02-24 Thread Markus Schaber
Hello, Recently, I wanted to create a table from a complex query in a specific tablespace, but CREATE TABLE name AS SELECT ... does not accept a tablespace argument. I worked around it by CREATE TABLE name AS SELECT ... LIMIT 0, then moving the generated table to the other tablespace using ALTER

Re: [SQL] create table and data types

2006-02-14 Thread Bath, David
On Tue, 2006-02-14 at 22:12 +0100, Maciej Piekielniak wrote: (snipped) >Is anybody know how create field in a new table with data type accuiring >from a field in other table? >For example: > create table new_table ( name other_table.name%TYPE); On Wed, 15 Feb 2006 09:42, Ken Hill wrote: (snipped)

Re: [SQL] create table and data types

2006-02-14 Thread Ken Hill
On Tue, 2006-02-14 at 23:03 +0100, Maciej Piekielniak wrote: Hello Ken, Tuesday, February 14, 2006, 10:30:34 PM, you wrote: KH> On Tue, 2006-02-14 at 22:12 +0100, Maciej Piekielniak wrote: >> Hello pgsql-sql, >> >> Is anybody know how create field in a new table with data type accuiring

Re: [SQL] create table and data types

2006-02-14 Thread Tom Lane
Maciej Piekielniak <[EMAIL PROTECTED]> writes: > Is anybody know how create field in a new table with data type accuiring > from a field in other table? Sorry, the %TYPE syntax only works in function declarations at the moment. It could possibly be made to work in table declarations --- there

Re: [SQL] create table and data types

2006-02-14 Thread Maciej Piekielniak
Hello Ken, Tuesday, February 14, 2006, 10:30:34 PM, you wrote: KH> On Tue, 2006-02-14 at 22:12 +0100, Maciej Piekielniak wrote: >> Hello pgsql-sql, >> >> Is anybody know how create field in a new table with data type accuiring >> from a field in other table? >> For example: >> >> create ta

Re: [SQL] create table and data types

2006-02-14 Thread Ken Hill
On Tue, 2006-02-14 at 22:12 +0100, Maciej Piekielniak wrote: Hello pgsql-sql, Is anybody know how create field in a new table with data type accuiring from a field in other table? For example: create table new_table ( name other_table.name%TYPE ); Have you tried inheritance from o

[SQL] create table and data types

2006-02-14 Thread Maciej Piekielniak
Hello pgsql-sql, Is anybody know how create field in a new table with data type accuiring from a field in other table? For example: create table new_table ( name other_table.name%TYPE ); -- Best regards, Maciej mailto:[EMAIL PROTECTED] ---

Re: [SQL] CREATE TABLE AS SELECT

2005-07-29 Thread daq
JB> Offered up because I have no explanation, and curiosity overwhelms me: JB> I was attempting to create a table from a SELECT statement against JB> another table: JB> create table foo JB> as select JB> a, JB> f(b) JB> from xxx; In this command table foo populated after the select statement

[SQL] CREATE TABLE AS SELECT

2005-07-29 Thread Jeff Boes
Offered up because I have no explanation, and curiosity overwhelms me: I was attempting to create a table from a SELECT statement against another table: create table foo as select a, f(b) from xxx; The function f() attempts to make a unique value based on its argument (it's actually a "usernam

Re: [SQL] CREATE TABLE AS SELECT....

2004-09-20 Thread Andrew Hammond
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Arash Zaryoun wrote: | Hi All, | | I have a table which has 'SERIAL' datatype. When I use 'create table X | as select * from my-table' , it creates the table but without serial | datatype. I mean without implicit sequence. | | test=> \d qptuser |

[SQL] CREATE TABLE AS SELECT....

2004-09-16 Thread Arash Zaryoun
Hi All, I have a table which has 'SERIAL' datatype. When I use 'create table X as select * from my-table' , it creates the table but without serial datatype. I mean without implicit sequence. test=> \d qptuser Table "public.qptuser" Column | Type

Re: [SQL] Create table syntax

2001-08-30 Thread Stephan Szabo
On 28 Aug 2001, satish rao wrote: > Entered below is the SQL create table syntax: > > CREATE TABLE lists ( > [listid] [int] IDENTITY (1, 1) NOT NULL , > [listname] [varchar] (200) NULL , > [listcreator] [varchar] (200) NULL , > [listdesc] [text

[SQL] Create table syntax

2001-08-30 Thread satish rao
Hi Entered below is the SQL create table syntax: CREATE TABLE lists ( [listid] [int] IDENTITY (1, 1) NOT NULL , [listname] [varchar] (200) NULL , [listcreator] [varchar] (200) NULL , [listdesc] [text] NULL) We need to know that this syntax will work properly in

Re: [SQL] create table

2001-05-06 Thread Albert REINER
On Sun, Apr 29, 2001 at 09:34:29PM +0200, LeoDeBeo wrote: > can anybody explain me the syntax of Create Table documentation?? ... > i also don't understand what the [ ... ] and [, ... ] means. I do know that > brackets denote options and | alternatives. I guess: ``[ ... ]'' means that you may

Re: [SQL] create table

2001-05-04 Thread Martín Marqués
On Dom 29 Abr 2001 22:34, LeoDeBeo wrote: > can anybody explain me the syntax of Create Table documentation?? > > CREATE [ TEMPORARY | TEMP ] TABLE table ( > column type > [ NULL | NOT NULL ] [ UNIQUE ] [ DEFAULT value ] > [ column_constraint_clause | PRIMARY KEY } [ ... ]

Re: [SQL] create table

2001-05-04 Thread Tom Lane
LeoDeBeo <[EMAIL PROTECTED]> writes: > i don't understand what the curly brace means after PRIMARY KEY (where is > the other matching brace? Typo. Try more recent versions of the docs. 7.1 says CREATE [ TEMPORARY | TEMP ] TABLE table_name ( { column_name type [ column_constraint [ ... ]

[SQL] create table

2001-05-04 Thread LeoDeBeo
can anybody explain me the syntax of Create Table documentation?? CREATE [ TEMPORARY | TEMP ] TABLE table ( column type [ NULL | NOT NULL ] [ UNIQUE ] [ DEFAULT value ] [ column_constraint_clause | PRIMARY KEY } [ ... ] ] [ , ... ] [ , PRIMARY KEY ( column

Re: [SQL] CREATE TABLE AS and ORDER BY

2001-02-23 Thread CM
"Joy Chuang" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > I tried to use CREATE TABLE AS and ORDER BY. The query is as followed: > > create table freshhr21 as > select e.studentid, u.hoursxfer > from enrollmentstatus e, undergradclass u > where e.st

Re: [SQL] CREATE TABLE AS and ORDER BY

2001-02-06 Thread Jie Liang
Hey, Try: select e.studentid, u.hoursxfer into freshhr21 from enrollmentstatus e, undergradclass u where e.studentid = u.studentid and e.classtd = '1' order by u.hoursxfer Jie LIANG Internet Products Inc. 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 [EMAIL

Re: [SQL] CREATE TABLE AS and ORDER BY

2001-02-06 Thread Tom Lane
Joy Chuang <[EMAIL PROTECTED]> writes: > But, it returns error message "ERROR: parser: parse error at or near > "order"". Does "create table as" support "order by" inside of it? Evidently not. > I am using PostgreSQL 6.5.3. It seems to work in 7.0 and later. regards,

[SQL] CREATE TABLE AS and ORDER BY

2001-02-06 Thread Joy Chuang
Hi, I tried to use CREATE TABLE AS and ORDER BY. The query is as followed: create table freshhr21 as select e.studentid, u.hoursxfer from enrollmentstatus e, undergradclass u where e.studentid = u.studentid and e.classtd = '1' order by u.hoursxfer But, it returns error message "ERROR: parser:

Re: [SQL] Create table doesn't work in plpgsql

2000-12-23 Thread Keith Wong
I believe a couple of months back... a EXECUTE command was added to plpgsql to allow users to dynamic sql statements. So if you get the current development version you should be able to call EXECUTE CREATE TABLE or whatever sql you like. (I think this is still not in 7.03, not sure though

Re: [SQL] Create table doesn't work in plpgsql

2000-12-23 Thread Stephan Szabo
I believe (although I haven't tried it) that pltcl will allow you to do things such as this. On Thu, 21 Dec 2000, Volker Paul wrote: > Hi, > > > I don't think you can use DDL(data definition language) in PL/SQL. > > create table is not DML(data munipulation lang

Re: [SQL] Create table doesn't work in plpgsql

2000-12-22 Thread Volker Paul
> Can this be done using tcl or perl? I'll try them and report what I find out. V.Paul

Re: [SQL] Create table doesn't work in plpgsql

2000-12-21 Thread Jie Liang
ECTED] www.ipinc.com On Thu, 21 Dec 2000, Volker Paul wrote: > Hi, > > > I don't think you can use DDL(data definition language) in PL/SQL. > > create table is not DML(data munipulation language) instead > > it's a DDL. > Thanks, but that leaves me with a proble

Re: [SQL] Create table doesn't work in plpgsql

2000-12-21 Thread Mike Castle
On Thu, Dec 21, 2000 at 11:51:38AM +0100, Volker Paul wrote: > select famname || ', ' || givname from person where id=1234; > I know it's possible by building the select e.g. in bash > and calling psql with it as an argument, but do you see a possibility > that is closer to Postgres, e.g. in plpgs

Re: [SQL] Create table doesn't work in plpgsql

2000-12-21 Thread Volker Paul
Hi, > I don't think you can use DDL(data definition language) in PL/SQL. > create table is not DML(data munipulation language) instead > it's a DDL. Thanks, but that leaves me with a problem. What I really want to do is something like select str from person where id=1234; wh

Re: [SQL] Create table doesn't work in plpgsql

2000-12-20 Thread Jie Liang
Hi,there, I don't think you can use DDL(data definition language) in PL/SQL. create table is not DML(data munipulation language) instead it's a DDL. Jie LIANG Internet Products Inc. 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 [EMAIL

[SQL] Create table doesn't work in plpgsql

2000-12-19 Thread Volker Paul
Hi, can I do some table manipulation in plpgsql? Look at only the "create table" line and the error message: create function plural (text) returns text as ' begin create table tmp (num int4); return $1 || ''s''; end;' language 'plpgsql'; select plural('test'); CREATE ERROR: cop

Re: [SQL] Create table in functions

2000-08-24 Thread hlefebvre
Andreas Tille wrote: > What does this mean? The ERROR is caused by the Create Table statement > (when I removed it from my complex function it worked well). > So why doesn't this work and what copy function fails here?? Maybe you can create your table using a select into statement : something l

RE: [SQL] Create table in functions

2000-08-23 Thread Hiroshi Inoue
> -Original Message- > From: Tom Lane > > "Hiroshi Inoue" <[EMAIL PROTECTED]> writes: > > Hmm,Andreas's original function seems to contain other statements. > > If the function contains DML statements for the table Temp_Num_Table, > > it wouldn't work properly. i.e 1st call would work but

Re: [SQL] Create table in functions

2000-08-23 Thread Tom Lane
"Hiroshi Inoue" <[EMAIL PROTECTED]> writes: > Hmm,Andreas's original function seems to contain other statements. > If the function contains DML statements for the table Temp_Num_Table, > it wouldn't work properly. i.e 1st call would work but 2nd call woudn't. Are you thinking about plpgsql's cach

RE: [SQL] Create table in functions

2000-08-23 Thread Hiroshi Inoue
> -Original Message- > From: Tom Lane > > Andreas Tille <[EMAIL PROTECTED]> writes: > > web=# create function pHelpTable( ) > > web-# returns int > > web-# As ' > > web'# Begin > > web'# Create Table Temp_NumTable ( Num int ) ; > > web'# > > web'# return 17 ; > > we

Re: [SQL] Create table in functions

2000-08-23 Thread Jie Liang
Hi, there, I don't think that you can use DDL in PL/pgSQL, normally say , you can only use DML in PL/pgSQL. i.e. you can use select into,update,delete,insert ... , but you cannot use create, alter, grant ... Andreas Tille wrote: > Hello, > > I striped down my function up to a strange thing: >

Re: [SQL] Create table in functions

2000-08-23 Thread Tom Lane
Andreas Tille <[EMAIL PROTECTED]> writes: > web=# create function pHelpTable( ) > web-# returns int > web-# As ' > web'# Begin > web'# Create Table Temp_NumTable ( Num int ) ; > web'# > web'# return 17 ; > web'# End; ' > web-# language 'plpgsql' ; > CREATE The majori

[SQL] Create table in functions

2000-08-23 Thread Andreas Tille
Hello, I striped down my function up to a strange thing: web=# create function pHelpTable( ) web-# returns int web-# As ' web'# Begin web'# Create Table Temp_NumTable ( Num int ) ; web'# web'# return 17 ; web'# End; ' web-# language 'plpgsql' ; CREATE web=# web=# s

Re: [SQL] CREATE TABLE with foreign key and primary key

2000-07-10 Thread Oliver Elphick
"Paulo Roberto Siqueira" wrote: >ufgvirtual=# create table matricula ( >ufgvirtual(# id_aluno char(15) references pessoa, >ufgvirtual(# id_curso int4 references curso_polo, >ufgvirtual(# id_polo int2 references curso_polo, >ufgvirtual(# local_prova varchar(50) not null, >ufgvirtual(# a

[SQL] CREATE TABLE with foreign key and primary key

2000-07-09 Thread Paulo Roberto Siqueira
I'm trying to create a table that has three fields as primary key. These fields must exist in two other tables. id_aluno is primary key in table pessoa, id_curso and id_polo are primary key in table curso_polo. But it seems it won't work. What am I doing wrong? See definitions below. Speci