Jump to content
ludo1960

phppgadmin sql error

Recommended Posts

Hi guys,

Thought I would give postgres a go, installed it on debian 9 then installed phppgadmin. When I try to run SQL in phppgadmin:

CREATE TABLE `posts` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `author_id` int(10) unsigned NOT NULL ,
  `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `content` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `rate` int(255) COLLATE utf8_unicode_ci NOT NULL,
  `release_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

I get the following error:

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /usr/share/php/adodb/adodb-error.inc.phpon line 114

Even the SQL does not run, as I get the error:

SQL error:

ERROR:  syntax error at or near "`"
LINE 1: CREATE TABLE `posts` (
                     ^

Am i missing some sort of configuration in postgres or phppgadmin. I should add that I have installed drupal and laravel using the postgres database with no issues whatsoever, so postgres is working. I have got php7-2 installed, so I don't understand why phppgadmin is looking in /usr/share/php.

Any ideas guys?

Share this post


Link to post
Share on other sites
Posted (edited)

In MySQL you use backticks "`" around identifiers when the identifier name is a reserved keyword or contains a space or other special characters. In your code they would not be necessary.

In Postgres a different character from the backtick is used in those circumstances. The manual will tell you which.

While most RDMS systems have a standard core SQL there are variations between the various dialects. You have to be aware of them.

Edited by Barand

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.