E
E
EVOSandru62015-08-14 14:28:28
PostgreSQL
EVOSandru6, 2015-08-14 14:28:28

What does a once-only error mean in postgres?

Good afternoon, such a problem.
On the local machine, the Yii project works fine, but when transferred to the hosting, the following error occurs once:
CDbCommand failed to execute the SQL query: SQLSTATE[42601]: Syntax error: 7 ERROR: zero-length delimited identifier at or near """"
LINE 1: ..."t1_c13" FROM "m_users" "customer" WHERE ("customer".""=$1)
^. The SQL statement executed was: SELECT "customer"."id" AS "t1_c0", "customer"."name" AS "t1_c1", "customer"."role_id" AS "t1_c2", "customer"."email" AS "t1_c3", "customer"."password" AS "t1_c4", "customer"."contacts" AS "t1_c5", "customer"."sys_date" AS "t1_c6", "customer"."sys_date_update" AS " t1_c7", "customer"."sys_user" AS "t1_c8", "customer"."exist" AS "t1_c9", "customer"."status" AS "t1_c10", "customer"."category_id" AS "t1_c11" , "customer"."photo_id" AS "t1_c12", "customer"."photo" AS "t1_c13" FROM "m_users" "customer" WHERE ("customer".""=:ypl0).

Bound with :ypl0=7 After one or two page refreshes, the error disappears and the site continues to work normally.
Here is the user table:

CREATE TABLE m_users


(
  id serial NOT NULL,
  name character varying(255),
  role_id integer NOT NULL,
  email character varying(255) NOT NULL,
  password character varying(32),
  contacts text,
  sys_date integer,
  sys_date_update integer,
  sys_user integer,
  exist smallint DEFAULT 1::smallint,
  status integer DEFAULT 1,
  category_id integer,
  photo_id integer,
  photo character varying(255),
  CONSTRAINT pk_users_id PRIMARY KEY (id),
  CONSTRAINT fk_users_roles1 FOREIGN KEY (role_id)
      REFERENCES f_roles (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT m_users_photo_id_fkey FOREIGN KEY (photo_id)
      REFERENCES mc_photo (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT m_users_type_person_id_fkey FOREIGN KEY (category_id)
      REFERENCES f_category_person (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT m_users_email_key UNIQUE (email)
)

Here is the model:
<?php
class Users extends ActiveRecord
{

...

    public function tableName()
  {
    return 'm_users';
  }

  public function rules()
  {
    return
        [
      ['name', 'required'],
      ,
      ,
      ,
              // регистрация
            ['password', 'compare', 'compareAttribute'=>'verifyPassword', 'on'=>['registration']],
              // обновление пароля
            ['email', 'email'],
            ['email', 'unique'],
            ['newPassword', 'compare', 'compareAttribute'=>'verifyPassword', 'on'=>['password']],
      ['role_id, ban, category_id, sys_date, sys_date_update, sys_user, exist', 'numerical', 'integerOnly'=>true],
      ['name, email', 'length', 'max'=>255],
      ['password', 'length', 'max'=>32],
      ['contacts, verifyPassword, newPassword', 'safe'],
            ['verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements(), 'on'=>'registration'],
      ['id, name, role_id, email, password, contacts, sys_date, sys_date_update, sys_user, exist', 'safe', 'on'=>'search'],

            [['photo','pictures'], 'file', 'types' => 'jpg, png, gif', 'allowEmpty' => true],

        ];
  }

  public function relations()
  {
    return
        [
           
            'role' => [self::BELONGS_TO, 'Roles', 'role_id'],
            'user' => [self::BELONGS_TO, 'Users', 'sys_user'],
            'bookmarks' => [self::MANY_MANY, 'Users', 'l_bookmarks(customer_id, driver_id)'],
            'category_person' => [self::BELONGS_TO, 'CategoryPerson', 'category_id'],
            'configs'=>[self::MANY_MANY, 'ConfigUser','l_users_22_config(id_1, id_2)'],
            'images'=>[self::MANY_MANY, 'Photo','l_users_22_photo(id_1, id_2)'],
            'offers'=>[self::HAS_MANY, 'Offers','driver_id'],
            'ban'=>[self::HAS_ONE, 'Ban','user_id'],
        ];
  }

  
  public function search()
  {
    $criteria=new CDbCriteria;

    $criteria->compare('id',$this->id);
    $criteria->compare('name',$this->name,true);
    $criteria->compare('role_id',$this->role_id);
    $criteria->compare('email',$this->email,true);
    $criteria->compare('password',$this->password,true);
    $criteria->compare('contacts',$this->contacts,true);
    $criteria->compare('sys_date',$this->sys_date);
    $criteria->compare('sys_date_update',$this->sys_date_update);
    $criteria->compare('sys_user',$this->sys_user);
    $criteria->compare('exist',$this->exist);

        $criteria->condition = 'exist != 2';

        return new CActiveDataProvider($this,
            [
                'criteria'=>$criteria,
                'pagination'=>array('pageSize'=>100),
            ]);
  }

  public static function model($className=__CLASS__)
  {
    return parent::model($className);
  }
}

Where to dig?

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
D
Dmitry Donkovtsev, 2015-10-16
@Demetriy

FROM "m_users" "customer"

I think a comma is missing here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question