
175 Cal.App.2d 343 (1959)
THE PEOPLE, Appellant,
v.
EARL HANSEL BUCHER, Respondent.
Crim. No. 3540. 
California Court of Appeals. First Dist., Div. Two.  
Nov. 17, 1959.
 Edmund G. Brown and Stanley Mosk, Attorneys General, Clarence A. Linn, Chief Assistant Attorney General, Raymond M. Momboisse and Doris H. Maier, Deputy Attorneys General, Thomas C. Lynch, District Attorney (San Francisco), and Doris Schnacke, Assistant District Attorney, for Appellant.
 William J. Gintjee and Jack P. Wong for Respondent.
 KAUFMAN, P. J.
 The State appeals from an order granting the defendant's motion to dismiss the information, under section 995 of the Penal Code, on the specific grounds of failure of the People to comply with section 861 of the Penal Code.
 The defendant, E. H. Bucher, was arrested and placed in custody on February 7, 1958. The preliminary hearing began at 3 p. m. on Thursday, February 27th. Four witnesses were examined by the People and cross-examined by the defendant's counsel. This evidence indicated that in response to a telephone call from Mrs. Glover on October 21, 1957, the defendant had a conversation with her at her home. This conversation resulted in a contract between Mrs. Glover and a Mr. J. W. Cook (whom she did not know) for the remodeling of Mrs. Glover's home at 1839-8th Avenue in San Francisco. The total cost of the remodeling was $3,675 and the defendant requested that the payments be made progressively. The contract was signed by Mrs. Glover. The defendant signed the name of J. W. Cook. At the time the contract was signed, the defendant did not have a contractor's license. On November 6th, defendant represented to Mrs. Glover that he needed to pay his men and for the material used in the remodeling of the home. Mrs. Glover gave him a check for $2,000 on November 6th; a check for $1,000 on November 13th; and a check for $576 on November *345 20th. At the time of the preliminary examination, over one-half of the work contracted for had been completed.
 Mr. Thornton, a masonry contractor, received a telephone call from a Mr. Cook, who asked for an estimate on the installation of a precast staircase at the Glover residence. Mr. Thornton installed the staircase and saw the defendant at the scene of the job. Mr. Thornton was never paid for his work. A Mr. Connors, a general contractor, was called by "Mr. Cook" who inquired about payment for the installation of a door at the Glover residence. Mr. Cook said that he had another job at the Glover residence, and asked for an estimate on the cost of installing the door. A price of $130 was agreed upon and the door installed. Mr. Connors was never paid for his work.
 The court then stated that there was not a sufficient showing to hold the defendant to answer. The district attorney then informed the court that one material witness was missing as the People had not been able to serve a subpoena on him. After a discussion off the record, the following took place:
 "The Court: Now, do you think you can get your witness in tomorrow?"
 "Mr. Auslen: We'll try again, your Honor."
 No affidavits were produced to support the request for a continuance. Over the objection of the defendant, the court ordered the matter over to the following day.
 On the next morning, Friday, February 28th, two witnesses were called by the People. Mrs. Christeson, the manager of the apartment house where the defendant lived testified that she often received messages for a Mr. Cook. Mr. J. W. Cook, an estimator and construction supervisor testified that he and the defendant and another party had set up a corporation called the "Construction Mart." However, the corporation was never effected and never received a contractor's license. Mr. J. W. Cook testified that he never made any representations about the premises at 1839-8th Avenue, that he never signed the contract for the work on those premises or authorized the defendant to do so. He also stated that in May, 1957, or in the summer, he had instructed the defendant to cease writing contracts, and that his contractor's license was suspended on November 21, 1957. After the completion of this evidence, the court held the defendant to answer.
 On March 10, 1958, the information was filed charging the defendant with three counts of grand theft. On March 31, 1958, the defendant moved to set aside the information under *346 section 995 of the Penal Code, because the prosecution had "failed to comply with the provisions of the Penal Code with reference to a preliminary hearing." Section 995 of the Penal Code provides that the information must be set aside (on the defendant's motion) if before the filing of the information, the defendant has not been legally committed by a magistrate or if the defendant has been committed without reasonable or probable cause.
 Section 861 of the Penal Code provides:
 "The examination must be completed at one session, unless the magistrate, for good cause shown by affidavit, postpone it. The postponement cannot be for more than two days at each time, nor more than six days in all, unless by consent or on motion of the defendant. (Enacted 1872.)"
 Section 862 provides:
 "If a postponement is had, the magistrate must commit the defendant for examination, admit him to bail or discharge him from custody upon the deposit of money as provided in this code, as security for his appearance at the time to which the examination is postponed. (Enacted 1872.)"
 The question presented is whether the postponement of a preliminary hearing, over the objections of the defendant from one afternoon to the next morning without any showing of good cause by affidavit, is an illegal commitment. [1] The primary purpose of the preliminary examination is the determination of whether a public offense, triable in the superior court, has been committed and whether there is sufficient cause to believe the defendant guilty thereof. (Jaffe v. Stone, 18 Cal.2d 146 [114 P.2d 335, 135 A.L.R. 775].) [2] The procedures prescribed by the Legislature for the conduct of the preliminary examination are designed to protect the rights of the accused and to see to it that no one is detained in custody indefinitely or capriciously in order that a case may be developed in the future, or circumstances arise that will justify a trial. The interests of society do not demand, and the rights of the individual forbid, such an invasion of personal liberty. The question is whether the continuance granted in the instant case is such a violation of defendant's basic rights that he was "not legally committed by a magistrate," or whether it was a technical error or irregularity not going to the merits.
 Section 861 was construed in People v. Van Horn, 119 Cal. 323 [51 P. 538]. There, the committing magistrate, upon affidavit of the prosecution showing the absence of material *347 witnesses, postponed the hearing for a period of more than six days. The affidavit made for the continuance was not sufficient. In all other respects, however, the preliminary examination was regularly had and the order of commitment properly made. On appeal from the judgment of conviction, the defendant argued that there had been a violation of section 861. Our Supreme Court rejected this contention deciding that a defect in the preliminary examination is not a ground for appeal from the judgment of conviction entered after trial in the superior court.
 [3] If the motion under 995 of the Penal Code had been denied by the superior court, no writ of prohibition would lie. That writ lies only to bar action in excess of jurisdiction, and no jurisdictional factor is involved here. (Rogers v. Superior Court, 46 Cal.2d 3 [291 P.2d 929]; Mitchell v. Superior Court, 50 Cal.2d 827 [330 P.2d 48].)
 [4] Here, the superior court granted defendant's motion to dismiss the information under section 995 of the Penal Code on the specific grounds of failure of the People to comply with section 861 of the Penal Code. A motion under 995 of the Penal Code may be granted when the defendant has "not been legally committed by a magistrate." There was, therefore, discretion and power on the part of the superior court to find under the facts of this case that there was a violation of that section [Pen. Code,  861] which affected the legality of Bucher's commitment. If we were to hold that the superior court did not have such a discretion, then the defendant would not have a remedy against such illegal custody as results from a violation of 861 of the Penal Code.
 The attorney general on this appeal asks us to hold as a matter of law that the superior court cannot grant a motion under section 995 of the Penal Code on the ground of violation of section 861 of the Penal Code. It seems obvious that to so hold would deny all discretion to the superior court and to, in effect, remove section 861 of the Penal Code from the statutes.
 In view of the foregoing, the order granting the motion to dismiss the information must be affirmed.
 Order affirmed.
 Dooling, J., and Draper, J., concurred.
