error on update using SqlProvider.PostgreSQL
rhmnmbr opened this issue · comments
rhmnmbr commented
- error:
42703: column "app_user" of relation "app_user" does not exist
- postgre version:
PostgreSQL 14.4
- recorded query:
UPDATE app_user SET app_user.username = $1, app_user.password_hash = $2, app_user.password_salt = $3, app_user.password_changed_at = $4, app_user.name = $5, app_user.otp = $6, app_user.otp_expires_at = $7, app_user.role_id = $8, app_user.created_at = $9, app_user.updated_at = $10 WHERE app_user.id = $11
Serge K commented
@rhmnmbr83 It is not enough... I just google it: https://stackoverflow.com/questions/17104837/pgsql-error-code-42703-column-does-not-exist
Provide some information, please:
- Publish your c# class with attributes
- Which method do you use for update?
- Publish generated SQL by this library
- Publish correct SQL without error for this update
rhmnmbr commented
@rhmnmbr83 It is not enough... I just google it: https://stackoverflow.com/questions/17104837/pgsql-error-code-42703-column-does-not-exist
Provide some information, please:
- Publish your c# class with attributes
- Which method do you use for update?
- Publish generated SQL by this library
- Publish correct SQL without error for this update
[Table("app_user")]
public class User
{
[Key, Identity]
[Column("id")]
public long Id { get; set; }
[Column("username")]
public string Username { get; set; } = string.Empty;
[Column("password_hash")]
public byte[]? PasswordHash { get; set; }
[Column("password_salt")]
public byte[]? PasswordSalt { get; set; }
[Column("password_changed_at")]
public DateTime? PasswordChangedAt { get; set; }
[Column("name")]
public string? Name { get; set; }
[Column("otp")]
public string? Otp { get; set; }
[Column("otp_expires_at")]
public DateTime? OtpExpiresAt { get; set; }
[Column("role_id")]
public int RoleId { get; set; }
[LeftJoin("app_role", "role_id", "id")]
public Role Role { get; set; } = default!;
[LeftJoin("b_member", "id", "user_id")]
public Member Member { get; set; } = default!;
[Column("created_at")]
public DateTime CreatedAt { get; set; } = DateTime.SpecifyKind(DateTime.UtcNow, DateTimeKind.Local);
[UpdatedAt]
[Column("updated_at")]
public DateTime? UpdateAt { get; set; }
}
UPDATE app_user
SET
app_user.username = $1,
app_user.password_hash = $2,
app_user.password_salt = $3,
app_user.password_changed_at = $4,
app_user.name = $5,
app_user.otp = $6,
app_user.otp_expires_at = $7,
app_user.role_id = $8,
app_user.created_at = $9,
app_user.updated_at = $10
WHERE app_user.id = $11
rhmnmbr commented
rhmnmbr commented
@rhmnmbr Can you reproduce it with a unit test?
I'm sorry, but I'm currently busy for a while.
Serge K commented
@rhmnmbr Let's close it? Because all current tests are fine. I guess something wrong with your PostgreSQL instance.