6

I'm using the PostgreSQL servers in phpPgAmin and all I want to do is create one table using SQL code. This is the code I'm using in its entirety.

CREATE TABLE BIDS (
 BIDID               NUMERIC(3) NOT NULL,
 CLIENTID            NUMERIC(3) NOT NULL,
 BIDDINGDATE         DATE,
 DESCRIPTION         TEXT,
 PRICE               NUMERIC(4,2),
 HOURLYRATE          BOOLEAN,
 APPROVED            BOOLEAN NOT NULL,
 COMMENTS            TEXT
 CONSTRAINT BIDS_PRIMARY_KEY PRIMARY KEY (BIDID));

This code should create the table, add some attributes and create a primary key. However, when I execute the SQL it throws this error.

enter image description here

I have no idea why that error occurs since there is no SELECT statement in my code. Is this a common occurrence with phpPgAdmin or PostgreSQL? If so, what should I do in order to create the table properly? Keep in mind that I need to do it using SQL code.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Ben
  • 1,299
  • 3
  • 17
  • 37
  • This sounds like a phpPgAdmin bug as the error message has nothing to do with your code. You should try a different (better) SQL client. –  Nov 20 '14 at 09:27

1 Answers1

6

The phpPgAdmin UI provides two links for running SQL - one in the main body of the page, and one in the menu bar at the top of the page.

The one in the main body of the page will throw the error you're seeing if you run a data definition statement like CREATE TABLE.

However, the one in the menu bar will run data definition queries with no problem.

In short:

enter image description here

Sasi
  • 188
  • 1
  • 13