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

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

2008-12-15 Thread George Pavlov
your problem is a little unorthodox, but i will spare you the "why the heck do you want to do this?" discussion and assume you have good reasons... so here's a "dynamic SQL" approach: select 'create table test (id bigint, '|| array_to_string(array(select a||' text' from foo),', ')||');'; not pret

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

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

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: [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

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

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

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

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

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

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 |

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] NULL) create table lists

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 [ ... ]

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,

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 language) instead > > it's a DDL. >

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
Hi,there, I am not quite sure what you try to do. However, plpgsql allows you use any DDL, most of functions defined and sql operators. I don't see the problem. Jie LIANG Internet Products Inc. 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 [EMAIL PROTECTED] w

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; where str is a string th

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 PROTECTED] www.ipinc.com

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

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